Python Programming Language
Python Programming Language
LANGUAGE
A seminar report submitted in partial fulfillment for the
degree of Bachelor of Technology
Roll No.:201810101110073
INSTITUTE OF TECHNOLOGY
SHRI RAMSWAROOP MEMORIAL UNIVERSITY
2020
Acknowledgement
It is our proud privilege and duty to acknowledge the kind of help and guidance
received from several people in preparation of this report. It would not have been
possible to prepare this report in this form without their valuable help,
cooperation and guidance.
Misbah Naqvi
Table Of Contents
Acknowledgment i
1. Introduction
1.1 Python
2.1 Variables
2.2 String
3.1 Tuple
3.2 List
4.1 Loops
6. Conclusion
Introduction
Python
Python is a widely used high-level, general-purpose, interpreted, dynamic
programming language. Its design philosophy emphasizes code readability, and its
syntax allows programmers to express concepts in fewer lines of code than would
be possible in languages such as C++ or Java. The language provides constructs
intended to enable clear programs on both a small and large scale.
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.
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).
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), or
even complex numbers.
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:
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.
Creating Strings
In Python, we create a string by putting quotes around text. For example, we could
take our otherwise useless
• len("hello") 5 # size
Python Operator
Arithmetic Operator
x%y
Modulus - remainder of the division of left
% (remainder of
operand by the right
x/y)
Comparison Operator
x ==
== Equal to - True if both operands are equal
y
x !=
!= Not equal to - True if operands are not equal
y
Logical Operator
Operato
Meaning Example
r
and True if both the operands are true x and y
Tuples
A tuple is a sequence of immutable Python objects. Tuples are sequences, just like
lists. The differences between tuples and lists are, the tuples cannot be changed
unlike lists and tuples use parentheses, whereas lists use square brackets.
tup2 = (1, 2, 3, 4, 5 );
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.
list2 = [1, 2, 3, 4, 5 ];
Loops
Programming languages provide various control structures that allow for more
complicated execution paths.
nested loops You can use one or more loop inside any
another while, for or do..while loop.
Example:
For Loop:
Hello 1
Hello 2
Hello 3
Hello 4
Hello 5
While Loop:
>>> count = 0
count = count + 1
Conditional Statements:
Decision making is anticipation of conditions occurring while execution of the
program and specifying actions taken according to the conditions.
Statement Description
The code block within every function starts with a colon (:) and is indented.
Syntax:
"function_docstring"
function_suite
return [expression]
Scope of Python
Science
- Bioinformatics
System Administration
-Unix
-Web logic
-Web sphere
-CGI
Testing scripts
Internet Scripting
Component Integration
Database Programming
Gaming, Images, XML , Robot and more
Google makes extensive use of Python in its web search system, and 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 GIS
mapping products.
seem to be these:
Python is object-oriented
It's powerful
o Dynamic typing
o Library utilities
It's portable