0% found this document useful (0 votes)
62 views

Project Report Industrial Training: DAV Institute of Engineering & Technology, Jalandhar

The document provides an overview of an industrial training project completed by Madhav Verma through Coursera and the University of Michigan. The training covered fundamental Python concepts like data structures, APIs, and databases. Verma learned how to use variables, operators, functions, loops, strings, lists, dictionaries, files, and more in Python. He also created demonstrations of an API implementation and using databases. For his capstone project, Verma developed a maps application called MAPS that utilized the technologies learned in the course, including for data retrieval, processing, and visualization.

Uploaded by

madhav verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Project Report Industrial Training: DAV Institute of Engineering & Technology, Jalandhar

The document provides an overview of an industrial training project completed by Madhav Verma through Coursera and the University of Michigan. The training covered fundamental Python concepts like data structures, APIs, and databases. Verma learned how to use variables, operators, functions, loops, strings, lists, dictionaries, files, and more in Python. He also created demonstrations of an API implementation and using databases. For his capstone project, Verma developed a maps application called MAPS that utilized the technologies learned in the course, including for data retrieval, processing, and visualization.

Uploaded by

madhav verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Project Report

Industrial Training
M Code: 78336

DAV Institute of Engineering & Technology, Jalandhar


Department of Computer Science and Engineering

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

3. Conclusion and Future Work 26


INTRODUCTION

1.1 PROJECT CATEGORY

Programming in Python

1.2 ABOUT COURSERA

Coursera is the global online learning platform that offers anyone,


anywhere access to online courses and degrees from world-class
universities and companies.

1.3 ABOUT TRAINING

This training builds on the success of the Python for Everybody


course and introduces you the fundamental programming concepts
including data structures, networked application program interfaces,
and databases, using the Python programming language. In the
Capstone Project, you’ll use the technologies learned throughout the
training to design and create your own applications for data retrieval,
processing, and visualization.

1.4 OFFERED BY

University of Michigan

The mission of the University of Michigan is to serve the people of


Michigan and the world through preeminence in creating,
communicating, preserving and applying knowledge, art, and
academic values, and in developing leaders and citizens who will
challenge the present and enrich the future.

Page | 1
1.5 INSTRUCTOR

Charles Russell Severance

Charles Severance (a.k.a. Dr. Chuck) is a Clinical Professor at the


University of Michigan School of Information, where he teaches
various technology-oriented courses including programming,
database design, and Web development. Chuck has written a
number of books including Using Google App Engine, and Python for
Everybody. His research field is in the building of learning
management systems such as Sakai, Moodle, Blackboard, ANGEL,
and others.

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/

 Install Atom Text Editor


Download and Install Atom text editor from:
https://atom.io

 Use variables to store, retrieve and calculate information

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.

c) Python Variable Name rules-:


o Must start with a letter or underscore _
o Must consist of letters, numbers, and underscores
o Case Sensitive
o Eg:
Good: spam, eggs, spam23, _speed
Bad: 23spam, #sign, var.12
Different: spam, Spam, SPAM

Reserved Words:
You cannot use reserved words as variable names / identifiers

Operators:

Highest precedence rule to lowest precedence rule:


a) Parentheses are always respected

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.

 Utilize core programming tools such as functions and loops.


Comparison Operators

Conditional Statements: if / elif / else


These statements include conditions along it and if the conditions are true
then they perform particular task else they ignore that task.

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)

Loops: while / for


While loop:
Syntax: while (condition):
Program execution

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

2.1.2 Python Data Structures


 Explain the principles of data structures & how they are used.
Strings:
a) A string is a sequence of characters.
b) We can get at any single character in a string using an index
specified in square brackets
c) The index value must be an integer and starts at zero

Page | 7
d) Looping in Strings:
fruit=’banana’
for letter in fruit:
print(letter)

e) String Slicing:

1) We can also look at any continuous section of a string using a


colon operator.
2) The second number is one beyond the end of the slice - “up to but
not including”.
3) If the second number is beyond the end of the string, it stops at the
end.

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

e) Lists are mutable.


f) Lists can also be sliced using colon :
g) We can iterate through lists using Loops.
h) List methods:

 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.

 Store data as key/value pairs using Python dictionaries.


Dictionaries:
a) Dictionaries are like bags - no order.
b) So we index the things we put in the dictionary with a “lookup tag”.

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

d) We loop through the key-value pairs in a dictionary using *two*


iteration variables.

Page | 10
e) Each iteration, the first variable is the key and the second variable is
the corresponding value for the key.

 Accomplish multi-step tasks like sorting or looping using tuples.


Tuples:
a) Tuples are another kind of sequence that functions much like a
list - they have elements which are indexed starting at 0.
b) Tuples are “immutable”.
c) Unlike a list, once you create a tuple, you cannot alter its
contents - similar to a string.

d) Tuple methods:

2.1.3 Using Python to Access Web Data


 Understand the protocols web browsers use to retrieve documents
and web apps.
TCP (Transmission Control Protocol)
TCP (Transmission Control Protocol) is a standard that defines how
to establish and maintain a network conversation through
which application programs can exchange data. TCP works with the
Internet Protocol, which defines how computers

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.

HTTP (Hyper Text Transfer Protocol)


The HyperText Transfer Protocol is the set of rules to allow browsers
to retrieve web documents from servers over the Internet.
GET Request
a) Each time the user clicks on an anchor tag with an href= value to
switch to a new page, the browser makes a connection to the web
server and issues a “GET” request - to GET the content of the page
at the specified URL.
b) The server returns the HTML document to the browser, which formats
and displays the document to the user.
HTTP Request in Python
import socket
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect(('data.pr4e.org', 80))
cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\r\n\r\n'.encode()
mysock.send(cmd)
while True:
data = mysock.recv(512)
if (len(data) < 1):
break
print(data.decode(),end='')
mysock.close()
Using urllib in python
Since HTTP is so common, we have a library that does all the socket
work for us and makes web pages look like a file

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.

 Retrieve data from websites and APIs using Python.


API (Application programming interface)
The API itself is largely abstract in that it specifies an interface and
controls the behavior of the objects specified in that interface. The
software that provides the functionality described by an API is said to

Page | 13
be an “implementation” of the API. An API is typically defined in
terms of the programming language used to build an application.

API Security and Rate Limiting


a) The compute resources to run these APIs are not “free”.
b) The data provided by these APIs is usually valuable.
c) The data providers might limit the number of requests per day,
demand an API “key”, or even charge for usage.
d) They might change the rules as things progress.
 Work with XML (eXtensible Markup Language) data.
There are commonly two formats to represent data on Web :
XML and JSON
XML (eXtensible Markup Language)
Marking up data to send across net
XML Terminology
a) Tags- indicate the beginning and ending of elements.
b) Attributes - Keyword/value pairs on the opening tag of XML.
c) Serialize / De-Serialize - Convert data in one program into a common
format that can be stored and/or transmitted between systems in a
programming language-independent manner.

Parsing XML data using python

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.

2.1.4 Using Databases with Python


 Use the Create, Read, Update, and Delete operations to manage
databases.
Relational databases
Relational databases model data by storing rows and columns in
tables. The power of the relational database lies in its ability to
Page | 15
efficiently retrieve data from those tables and in particular where
there are multiple tables and the relationships between those tables
involved in the query.
SQL (Structured Query Language)
SQL is language we use to issue commands to databases.
a) Create data
b) Retrieve data
c) Update Data
d) Delete Data
SQLite Browser
a) SQLite is a very popular database - it is free and fast and small.
b) SQLite Browser allows us to directly manipulate SQLite files
http://sqlitebrowser.org/
c) SQLite is embedded in Python and a number of other languages.
Using Sqlite3 in python
Program-:
import sqlite3
conn = sqlite3.connect('example.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE stocks(date text, trans text, symbol text, qty real,
price real)''')
# Insert a row of data
c.execute("INSERT INTO stocks VALUES ('2006-01-
05','BUY','RHAT',100,35.14)")
# Save (commit) the changes
conn.commit()
# We can also close the connection if we are done with it.
# Just be sure any changes have been committed or they will be lost.
conn.close()
 Understand how data is stored across multiple tables in a database.
Representing Relationships in Database
a) Primary key - generally an integer auto-increment field.
b) Logical key - What the outside world uses for lookup.
c) Foreign key - generally an integer key pointing to a row in another
table.
Join Operation
a) The JOIN operation links across several tables as part of a select
operation.
b) You must tell the JOIN how to use the keys that make the connection
between the tables using an ON clause.

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:

2.3.4 Github link :


https://github.com/Madhav243/Google-Maps

CONCLUSION AND FUTURE WORK


In the nutshell, it can be summarized that the future scope of project circles
around maintaining information regarding:
 We can add more features in map canvas like satellite view , street
view ,etc.
 We can add GUI feature for user input using tkinter library.

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

You might also like