Project Report Industrial Training: DAV Institute of Engineering & Technology, Jalandhar
Project Report Industrial Training: DAV Institute of Engineering & Technology, Jalandhar
Industrial Training
M Code: 78336
Submitted by:
Madhav Verma
1803677
Date: 18/1/2021
Table of Contents:
1. Introduction 1
1.1 Project Category 1
1.2 About Coursera 1
1.3 About Training 1
1.4 Offered By 2
1.5 About Instructor
2. Technologies Learned 3
2.1 Overview 3
2.1.1 Getting Started with Python 3
2.1.2 Python Data Structures 9
2.1.3 Using Python to Access Web Data 14
2.1.4 Using Databases With Python 19
2.2 Demonstrations 21
2.2.1 API Implementation 21
2.2.2 Databases 22
2.3 Project (MAPS) 23
2.3.1 Introduction 23
2.3.2 Technologies used 23
2.3.3 Screenshots 24
2.3.4 Github link 25
Programming in Python
1.4 OFFERED BY
University of Michigan
Page | 1
1.5 INSTRUCTOR
Page | 2
TECHNOLOGIES LEARNED
2.1 OVERVIEW
2.1.1 Getting Started with Python
Install Python
Download and install Python 3.x from:
http://www.python.org/download/
Variables :
a) A variable is a named place in the memory where a programmer can
store data and later retrieve the data using the variable “name”
b) You can change the contents of a variable in a later statement
a. x = 12.2
b. y = 14
c. x = 100
Page | 3
d. Now x not equal to 12.2 , now its value has changed to 100.
Reserved Words:
You cannot use reserved words as variable names / identifiers
Operators:
Page | 4
b) Exponentiation (raise to a power)
c) Multiplication, Division, and Remainder
d) Addition and Subtraction
e) Left to right
type()
a) In Python variables, literals, and constants have a “type”.
b) We can ask Python what type something is by using the type()
function.
Comments in Python
a) Anything after a # is ignored by Python and that statement is known
as comment.
User Input
a) We can instruct Python to pause and read data from the user using
the input() function.
b) The input() function returns a string.
c) If we want to read a number from the user, we must convert it from a
string to a number using a type conversion function.
Page | 5
x=20
if x<2:
print(‘small’)
elif x<10:
print(‘Medium’)
else:
print(‘Large’)
print(‘All Done’)
Functions:
a) There are two kinds of functions in Python.
- Built-in functions that are provided as part of Python - print(),
input(), type(), float(), int() ...
- Functions that we define ourselves and then use them.
b) In Python a function is some reusable code that takes arguments(s)
as input, does some computation, and then returns a result or results
c) We define a function using the def reserved word.
d) We call/invoke the function by using the function name, parentheses,
and arguments in an expression.
e) Eg:
def addTwo(a,b):
added=a+b
return added
x=addTwo(3,5)
print(x)
Page | 6
Condition breaking statement
#end of loop
• While loops are called “indefinite loops” because they keep going
until a logical condition becomes False.
For Loop:
Syntax: for iteration_variable in definite_set :
task_statements
#end of for loop
• These loops are called “definite loops” because they execute an
exact number of times
Page | 7
d) Looping in Strings:
fruit=’banana’
for letter in fruit:
print(letter)
e) String Slicing:
Lists:
a) A collection allows us to put many values in a single “variable”
b) A collection is nice because we can carry all many values around in
one convenient package.
Page | 8
c) We can create an empty list and then add elements using the append
method
d) The list stays in order and new elements are added at the end of the
list
Create programs that are able to read and write data from files.
Opening Files in python:
a) Before we can read the contents of the file, we must tell Python
which file we are going to work with and what we will be doing with
the file
b) This is done with the open() function
c) open() returns a “file handle” - a variable used to perform
operations on the file
• handle = open(filename, mode)
• returns a handle use to manipulate the file
• filename is a string
• mode is optional and should be 'r' if we are planning to read
the file and 'w' if we are going to write to the file
d) Eg: fhand=open(“mbox.txt”,”r”)
e) A text file can be thought of as a sequence of lines.
f) A text file has newlines at the end of each line.
Reading Files in Python:
a) A file handle open for read can be treated as a sequence of strings
where each line in the file is a string in the sequence.
b) We can use the for statement to iterate through a sequence.
c) Remember - a sequence is an ordered set.
Page | 9
d) We can read the whole file (newlines and all) into a single string using
read() function.
c) get()
The pattern of checking to see if a key is already in a dictionary and
assuming a default value if the key is not there is so common that
there is a method called get() that does this for us
Page | 10
e) Each iteration, the first variable is the key and the second variable is
the corresponding value for the key.
d) Tuple methods:
Page | 11
send packets of data to each other. Together, TCP and IP are the
basic rules defining the Internet.
Sockets
a) In computer networking, an Internet socket or network socket is
an endpoint of a bidirectional inter-process communication flow
across an Internet Protocol-based computer network, such as
the Internet.
b) Python has built-in support for sockets.
Page | 12
Web Scraping
a) When a program or script pretends to be a browser and retrieves web
pages, looks at those web pages, extracts information, and then
looks at more web pages.
b) Search engines scrape web pages - we call this “spidering the web”
or “web crawling”.
c) We use BeautifulSoap free library in python to scrap web pages.
Page | 13
be an “implementation” of the API. An API is typically defined in
terms of the programming language used to build an application.
Page | 14
JSON (JavaScript Object Notation)
JSON (JavaScript Object Notation) is a lightweight data-interchange
format. It is easy for humans to read and write. It is easy for machines to
parse and generate.
JSON is built on two structures:
A collection of name/value pairs. In various languages, this is realized
as an object, record, struct, dictionary, hash table, keyed list, or
associative array.
An ordered list of values. In most languages, this is realized as
an array, vector, list, or sequence.
Page | 16
2.2 DEMONSTRATIONS
2.2.1 API IMPLEMENTATION
Page | 17
2.2.2 DATABASES
Page | 18
2.3 PROJECT
MAPS
2.3.1 INTRODUCTION
a) Makes a Google Map from user entered data.
b) Uses the Google Geodata API.
c) Caches data in a database to avoid rate limiting and allow restarting.
d) Visualized in a browser using the Google Maps API.
Page | 19
2.3.2 TECHNOLOGIES
a) Programming Language: Python
b) Database: SQLite
c) API: Google Maps
d) Frontend: HTML
2.3.3 SCREENSHOTS
User input
Database
Page | 20
Output:
Page | 21
The above mentioned points are the enhancements which can be done to
increase the applicability and usage of this project.
We have left all the options open so that if there is any other future
requirement in the system by the user for the enhancement of the system
then it is possible to implement them. I hope that project will serve its
purpose for which it is develop there by underlying success of process.
Page | 22