SSSIT Computer Education: Kphb-Hyderabad: 9866144861. Online Python Training Python
SSSIT Computer Education: Kphb-Hyderabad: 9866144861. Online Python Training Python
SSSIT Computer Education: Kphb-Hyderabad: 9866144861. Online Python Training Python
Kphb-hyderabad : 9866144861.
Online Python Training
Python
What is python?
As per the Python software Foundation, Python is a high level interactive,
interpreted and object oriented scripting language.
Programming languages
1. Programming languages are meant for developing both system
software as well as application software.
2. The programs which are supported to run the system is known as
system software various application software is nothing but the programs
which are used to achieve the specific requirements of the customer or
the client.
Scripting languages:
1. Mostly scripting languages are meant for developing application
software
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
2. the most of the scripting languages does not have the capability to
execute independently that means the scripting languages required the
support of system software.
Example for the scripting languages are JavaScript, Shell Script, python
etc
3. In order to work with the scripting languages does not required to install
special software‟s, but few scripting languages required to install
software‟s if you want to work with JavaScript that is not required to install
Special software whether your system should be loaded with the Notepad
and the basic browser is enough similarly if you want execute Shell Script
then your system should be loaded with any Unix based operating system
Note:
Python be inherited by taking the best powerful features of
programming languages and scripting languages
Applications of Python:
1. Web application development
2. Automation applications
3. Testing tools
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
4. Gaming applications
5. Internet of things - IOT
6. Data Analytics and data science
7. Artificial intelligence ...etc
Advantages of python
1. High level language
a. if any language which enable you to develop any application by
using regular English instructions such as capital alphabets, small
alphabets, 0 to 9 digits and special characters
2. Portability:
Portability always depends upon the source code.
i.e no matters what operating system we are using the syntax and
semantics of the language remains same.
4. Open source
Python is available to the world under GPL general public licence. Python
software can be used by anyone without paying a paisa. And it is giving
the facility we can also see the internals of the python if required we can
also make the amendments in the language and we can also release the
new flavours of python
5. Independent
Python script statement can be executed in irrespective of the operating
system, by taking the support of python virtual machine
6. Interpreted
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
7. Procedure oriented
In the procedure oriented programming the logic can be maintained
and manipulate in the form of functions
8. Object oriented
In the object-oriented programming the logic can be maintained and
manipulate in the form of class and object
With the help of the models we can develop any type of application
simple and easier
Batteries included
argpars For Command line arguments
boto is Amzon web services library
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
Flavours of Python
Flavours of Python is referred to different types of the Python Compilers
Cpython
It is Standard Python compiler implemented in c
Compiled Code by python is byte code. It can run on
interpreter existed on PVM created on C-Language
By Using CPython we can also execute c and c++ functions
and Programs
Jython
Initially it is called Jpython
It is implementation of python programming language which is
designed to run on jvm
Jython contains libraries which are useful for both python and
Java programs
IronPython
It is another implementation of Python For .Net Frame work . It
is written in C#
When Python Programs are Compiled an Intermediate
Language Instructions are Created But These Instructions Can
Be Understand by CLR
It is Providing Various Libraries for Both python and .NET
PyPy
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
Pythonxy
It is Also Python Implementation
we get after adding scientific and engineering related
Packages
Anaconda
Handling Large scale of Data processing
Data Analytics and Scientific computing called Anaconda
Cptyhon -- http://www.python.org/downloads
Jython – http://www.jython.org
IronPython – http://ironpython.net//
Pypy : -- http://pypy.org/download.html
Pythonxy : -- https://python-xy.github.io/downloads.html
Anaconda : -- https://www.continuum.io/downloads
NASA , LOS Alamos, Fermi lab, JPL, and other are Using
Python For Scientific Programming
History of Python:
Python was developed by Guido van Rossum in the late eighties and
early nineties at the National Research Institute for Mathematics and
Computer Science in the Netherlands.
2.Installation
www.python.org/downloads
Python Shell :
1.It is CUI [Character User Interface] Based
[Where can perform operations using keyboard]
2. Doesn‟t have any look and feel
3. Doesn‟t provide any onscreen tip [syntax help]
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
Python IDLE
1. Python IDLE Provides Look and Feel
2. GUI [Graphical user interface] Based
3. It is Providing Menu Support
4. In Python IDLE we can't clear the screen Using
os.system('cls')
5. In Python IDLE, It doesn't execute any OS Commands
Rather internally it will open OS Shell and execute OS
Command there only.
Steps :
1. Open IDLE
2. Select New File from the File Menu
3. Define required Script Statements
4. Select Save From the file menu and the file with
any name.py [Eg: first.py]
5.Select Run module [f5] From Run Menu
Steps:
1.Open command prompt
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
C:\Users\class>e:
E:\>cd Python_Online9
E:\Python_Online9>py second.py
101
<class 'int'>
140725914903328
2.Variables
* It is a space to store the data or
* It is named container which enable you to store the data
temporally during the program execution
Java :
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
Syn:[modifiers]b<datatype>b<identifiers>[=value];
Python:
Syn:<identifier>=<value>[;]
eno=10
ename="Ramesh";
3.Datatypes
4.Operators
5.Identifiers
Are nothing but all the names which are declared by us for our
programming requirements, Such as : Variable names, Function names,
Class names.....
Rules :
1. It must starts with an alphabet or _
2. It may be in Lower | Upper | Mixed cases
3. No Limit in the length of identifiers
4. It May Have digits
Eg: e00no; ena98me; [valid]
5. It may have a Special character [i.e. : _ ]
6. It should not be Python Keyword
6.Keywords
* These are nothing but reserved words
* Every keyword is having its importance in the program
* The meaning of the keyword can‟t be changed
* To know the keywords existed in the python then we have to use
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
import keyword
keyword.kwlist [shell and idle]
In script Mode --> print(keyword.kwlist)
>>> type(keyword.kwlist)
<class 'list'>
>>> len(keyword.kwlist) #35
iskeyword() :
It returns True if the given String is a keyword else it will return False
Eg: >>> keyword.iskeyword('Roja') #False
>>>keyword.iskeyword('as') #True
Print( ) :
- It an output functions from builtins module
- It used to display the result on the console
x=10
print(x) #10
print("welcome") #welcome
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
Eg2:
x=10
y=3.14
z="welcome"
print(x) #10
print(y) #3.14
print(z) #welcome
print(value,value,value,.....)
print(x,y,z) #10 3.14 welcome
Note : While printing multiple values using print function, then each value
is separated by a space, if you want provide any literal then we have to
use sep attribute in print( )
value of “end” attribute is „\n‟. if you want print in result in same line then
we have to use “end” attribute with end=‟‟.
x=10
y=3.14
z="welcome"
print(x,end='\n')
print(y,end='\n')
print(z,end='\n')
print(x,end='')
print(y,end='')
print(z,end='') # print(x,y,z,sep='')
We can use the Esc Sequence Char in both end or sep attribute of
print( ) if required
\n New Line
\a Bell sound
\t Horizontal .Tab(4)
\b Backspace
x=10
y=3.14
z="welcome"
SSSIT Computer Education
Kphb-hyderabad : 9866144861.
Online Python Training
Python
print(x,y,z,sep=' ')
print(x,y,z,sep='\t')
print(x,end='\t')
print(y,end='\t')
print(z,end='\t')
int --> %d
float --> %f
string -> %s
x=10 #int
y=3.14 #float
z="welcome" #str
print("%d" %x)
print("%f" %y)
name="sudha"
age=27
#NameBased
print("Name is :{} and age is :{}".format(name,age))
print("Name is :Mr|Mrs.{n} and age is :{a},{n} is from Hyd".
format(n=name,a=age))
#Output:
#Name is :Mr|Mrs.sudha and age is :27,sudha is from Hyd