Report 11
Report 11
of
Bachelor of Technology In
Computer Science & Engineering
in
Submitted by
MUSTAKIM ANSARI
20EBTCS023
Submitted to
First of all, I am indebted to the GOD ALMIGHTY for giving me an opportunity to excel in my
efforts to complete this industrial training on time.
The journey was a hit I had good experience & glad to have this course. Many thanks to
Coursera for providing such a skilful course.
My heartfelt gratitude to my industrial training guide Mr. Pankaj Gothwal, Computer Science
and Engineering, for her valuable suggestions and guidance in the preparation of the summer
training report.
I express my thanks to Mr. Pankaj Gothwal, Semester Councilor, and all the members and
friends for all the help and co-ordination extended in bringing out this summer training
successfully in time.
I will be failing in duty if I do not acknowledge with grateful thanks to the authors of the
references and other literatures referred to in this industrial training. Last but not the least; I am
very much thankful to my parents who guided me in every step which I took.
Page | 2
CERTIFICATE
Page | 3
LIST OF CONTENTS
1. INTRODUCTION
1.1 Python 7
1.2 History of python 8
1.3 Object Oriented Programming 9
1.4 Scripting Languag 9
1.5 Behind the Scene of Python 10
Page | 4
3.2.3 Built in Function
4. LOOPS & CONDITIONAL STATEMENTS
4.1 Loops 19
4.1.1 Loops Definition
4.1.2 Loops Example
4.2 Conditional Statement 20
4.2.1 Conditional Statement Definition
4.2.2 Conditional Statement Example
4.3 Function 21
4.3.1 Syntax & Examples
6. MINOR PROJECT 26
7. CONCLUSION 28
8. REFERENCES 29
Page | 5
LIST OF TABLE
Page | 6
Chapter 1
INTRODUCTION
1.1 Python
Page | 7
1.2 History
Python was conceived in the late 1980s, and its implementation was started in December
1989 by Guido van Rossum at CWI in the Netherlands as a successor to the ABC
language (itself inspired by SETL) capable of exception handling and interfacing with
the Amoeba operating system. Van Rossum is Python's principal author, and his
continuing central role in deciding the direction of Python is reflected in the title given to
him by the Python community, benevolent dictator for life (BDFL).
Page | 8
1.3 Scripting Language
A scripting or script language is a programming language that supports scripts,
programs written for a special run-time environment that automate the execution of
tasks that could alternatively be executed one-by-one by a human operator.
Scripting languages are often interpreted (rather than compiled). Primitives are usually
the elementary tasks or API calls, and the language allows them to be combined into
more complex programs. Environments that can be automated through scripting include
software applications, web pages within a web browser, the shells of operating systems
(OS), embedded systems, as well as numerous games.
A scripting language can be viewed as a domain-specific language for a particular
environment; in the case of scripting an application, this is also known as an
extension language. Scripting languages are also sometimes referred to as very
high-level programming languages, as they operate at a high level of abstraction, or
as control languages
programming, but most popular languages are class-based, meaning that objects are
instances of classes, which typically also determines their type.
Page | 9
1.5 About the origin of Python, Van Rossum wrote in 1996::
Over six years ago, in December 1989, I was looking for a "hobby" programming project
that would keep me occupied during the week around Christmas. My office ... would be
closed, but I had a home Computer, and not much else on my hands. I decided to write an
interpreter for the new scripting language I had been thinking about lately: a descendant
of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the
project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying
Circus).
Page | 10
Chapter 2
DATA TYPES
Data types determine whether an object can do something, or whether it just would not
make sense. Other programming languages often determine whether an operation makes
sense for an object by making sure the object
can never be stored somewhere where the operation will be performed on the object (this
type system is called static typing). Python does not do that.
Instead it stores the type of an object with the object, and checks when the
operation is performed whether that operation makes sense for that object (this is
called dynamic typing).
2.1 Python has many native data types. Here are the important ones:
Numbers can be integers (1 and 2), floats (1.1 and 1.2), fractions (1/2 and 2/3).
Page | 11
2.2 Variables
Variables are nothing but reserved memory locations to store values. This means that
when you create a variable you reserve some space in memory.
Based on the data type of a variable, the interpreter allocates memory and decides what
can be stored in the reserved memory. Therefore, by assigning different data types to
variables, you can store integers, decimals or characters in these variables.
Ex:
counter = 100 # An integer assignment
miles = 1000.0 # A floating point name
= "John" # A string
2.3 String
In programming terms, we usually call text a string. When you think of a string as a
collection of letters, the term makes sense.
All the letters, numbers, and symbols in this book could be a string.
For that matter, your name could be a string, and so could your address.
Page | 12
2.5 Python Operator
Page | 13
Logical Operator
Page | 14
Chapter 3
TUPLES
To access values in tuple, use the square brackets for slicing along with the index or
indices to obtain value available at that index. For example −
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5, 6, 7 ); print "tup1[0]: ",
tup1[0]
print "tup2[1:5]: ", tup2[1:5]
When the above code is executed, it produces the following result −
tup1[0]: physics
tup2[1:5]: [2, 3, 4, 5]
Tuples respond to the + and * operators much like strings; they mean concatenation and
repetition here too, except that the result is a new tuple,
not a string. In fact, tuples respond to all of the general sequence operations we
used on strings in the prior chapter –
Page | 15
Table 3.1 Built in tulip functions
Page | 16
LIST
The list is a most versatile datatype available in Python which can be written as a list of
comma-separated values (items) between square brackets. Important thing about a list is
that items in a list need not be of the same type. Creating a list is as simple as putting
different comma-separated values between square brackets. For example −
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5 ]; list3 = ["a", "b", "c",
"d"];
Similar to string indices, list indices start at 0, and lists can be sliced,
concatenated and so on.
Output:list1[0]: physics
list2[1:5]: [2, 3, 4, 5]
Page | 17
3.4 Python includes following list methods
Page | 18
Chapter 4
LOOPS
4.1 Loops
Programming languages provide various control structures that allow for more
complicated execution paths.
looping requirements.
Page | 19
Example:
For Loop:
>>> for mynum in [1, 2, 3, 4, 5]:
print "Hello", mynum
Hello
1
Hello
2
Hello
3
Hello
4
Hello
5
While Loop:
>>> count = 0
>>> while (count < 4): print
'The count is:', count count =
count + 1
The count is: 0
The count is: 1
The count is: 2
The count is: 3
Page | 20
4.3 Statements
Python programming language provides following types of decision making
statements. Click the following links to check their detail.
Example:
If Statement:
>>> state = “Texas”
>>> if state == “Texas”:
print “TX
TX
If...Else Statement:
>>> if state == “Texas”
print “TX”
else:
print “[inferior state]”
If...Else...If Statement:
>>> if name == “Paige”
print “Hi Paige!”
elif name == “Walker”:
print “Hi Walker!” else:
print “Imposter!”
Page | 21
14.3 Function
Function blocks begin with the keyword def followed by the function name and
parentheses ( ( ) ).
Syntex:
def functionname( parameters ):
"function_docstring"
function_suite
return [expression]
Example:
1. def printme( str ):
"This prints a passed string into this function"
print str
return
Page | 22
Chapter 5
Companies like Google makes extensive use of Python in its web search system,
employs. Python’s creator. Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and
IBM use Python. For hardware testing. ESRI uses Python as an end-user
customization tool for its popular GI mapping products. The YouTube video sharing
service is largely written in Python.
Page | 24
5.4 Why Do People Use Python?
The following primary factors cited by Python users seem
to be these:
a) Python is object-oriented.
b) Structure supports such concepts as polymorphism, operation overloading, and
multiple inheritance.
c) Indentation is one of the greatest future in Python. It's free (open source)
d) Source code is easily accessible
Page | 25
Chapter 6
Python Project
Project Code:
import string
import random
if __name__ == "__main__":
s1 = string.ascii_uppercase
#print(s1)
s2 = string.ascii_lowercase
#print(s2)
s3 = string.digits
#print(s3)
#s4 = string.punctuation
#print(s4)
plen = int(input("enter password lengths\n"))
s = []
s.extend(list(s1))
s.extend(list(s2))
s.extend(list(s3))
#s.extend(list(s4))
#print(s)
random.shuffle(s)
#print(s)
print("".join(s[0:plen]))
Output:
Page | 26
Project Snapshot:
Page | 27
CONCLUSIONS
Practical knowledge means the visualization of the knowledge, which we read in our
books. For this, we perform experiments and get observations. Practical knowledge is very
important in every field. One must be familiar with the problems related to that field so
that he may solve them and become a successful person.
After achieving the proper goal in life, an engineer has to enter in professional life.
According to this life, he has to serve an industry, may be public or private sector or self-
own. For the efficient work in the field, he must be well aware of the practical knowledge
as well as theoretical knowledge.
Due to all above reasons and to bridge the gap between theory and practical, our
Engineering curriculum provides a practical training of 30 days. During this period
a student work in the industry and get well all type of experience and knowledge about the
working of companies and hardware and software tools.
Page | 28
References
a) . https://www.w3schools.com
b). https://www.coursera.org
c).https://www.wikipedia.org
d).https://www.python.org
Page | 29
Page | 30