SlideShare a Scribd company logo
LET’S GO WITH
PYTHON
PREPARED BY…
V.VIDHIYA BHARATHY
ABOUT PYTHON
– First appearance at 20th Feb 1991.
– Developer: Python Software Foundation.
– Designed By: Guido Van Rossum.
– Stable Release: 2.7.14- Dec 17
3.6.4 – Dec 17
– File Extensions: .py, .pyc, .pyd, .pyo, .pyw, .pyz
– Popular IDE’s: pycharm, pydev, wing IDE, komodo IDX, Eric IDE
SPECIALITIES OF PYTHON
– High level programming language.
– Interpreted language.
– Dynamic type system .
– Automatic memory management.
– Object oriented programming.
– Functional and procedural programming.
– Large and comprehensive standard library.
BASIC COMMANDS
– Printing output: print(), print(‘welcome’), print(“welcome”)
– Getting input: input(),input(‘enter the value’)
int(input(‘getting integer number’), float(input(‘getting floating number’)
eval(input(‘getting input at any data type’), raw_input(‘getting input as string’)
VARIABLES
– name=‘star’  Assigning a string content to a variable
– rollno=1 Assigning a integer value to a variable
– Avg=92.39 Assigning a float value to a variable
– Dynamic memory allocation is followed here.
– We can remove the variable by “del” command
– del name
– Termination symbol “;” is not needed for every command but the Indentation
is important.
OPERATORS
– Arithmetic operators +,-,*,/
– Identity operator  “is”, “is not”
– Comparison operator <, >,!=, =
– Logical operator ”and”, “or”, “not”
– Membership operator ”in”
– Increment or decrement is only by x=x+1 (or) x+=1
– Boolean expression  “true”, ”false”
CONTROL STRUCTURES
– Conditional Branching  if, if…else, elif s-start
– Looping Statements  while and for statements e-end
st-step
if (): while(-----): for( I in range(s-,e-,st-)):
executable statement executable executable
elif(): statements statements
executable statement
else:
default statement
FUNCTIONS/MODULES
– Two types of functions are here, they are
standard library functions
User defined functions
– Standard library functions like math, random, time and etc…
– Three ways to import the library functions:
– import math
– import math as m
– from math import *
USER DEFINED FUNCTION
def function_name():
attributes required;
#Function_call using the function name
Function_name() function call
# (command line)
LIST
– Collection of certain values
– A=10 variable assignment
– A=[10,20,30] list(ie, like array )
– List will support all data type in a single storage variable for example,
B=[10,10.90,’start’]
– Dynamic addition, indexing, slicing are possible
TUPLE
– A=(1,2,3,4)
– The circular braces is used for tuple, and for list square braces is used.
– With this tuple we can retrieve the tuple and we can do indexing and slicing but
cannot do any modification into it.
– This is one of the specialities in python.
DICTIONARY
– Week={1:’sun’, 2:’mon’, 3:’tue’, 4:’wed’, 5:’thu’, 6:’fri’, 7:’sat’}
– The dictionary storage has two attribute in a element, that is first one is key
value : corresponding value.
– Retriving , deleting ,copying and updating elements can be done with this
storage.

More Related Content

What's hot

system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarsystem management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
GauravRaikar3
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-liners
daoswald
 
Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-files
noahjamessss
 
Getting help in RHel 7 / CentOS 7
Getting help in RHel 7 / CentOS 7Getting help in RHel 7 / CentOS 7
Getting help in RHel 7 / CentOS 7
Nilesh Vaghela
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell ScriptingMustafa Qasim
 
Python Programming in Entertainment Industry: Coding Style
Python Programming in Entertainment Industry: Coding StylePython Programming in Entertainment Industry: Coding Style
Python Programming in Entertainment Industry: Coding Style
Shuen-Huei Guan
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)meashi
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
Manav Prasad
 
Vim Script Programming
Vim Script ProgrammingVim Script Programming
Vim Script ProgrammingLin Yo-An
 
Unix Programming with Perl 2
Unix Programming with Perl 2Unix Programming with Perl 2
Unix Programming with Perl 2
Kazuho Oku
 
PenTest using Python By Purna Chander
PenTest using Python By Purna ChanderPenTest using Python By Purna Chander
PenTest using Python By Purna Chander
nforceit
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
Sadia Bashir
 
Operating Systems 2
Operating Systems 2Operating Systems 2
Operating Systems 2
hutchison
 
Operating Systems 1
Operating Systems 1Operating Systems 1
Operating Systems 1
hutchison
 
bash
bashbash
Python for Penetration testers
Python for Penetration testersPython for Penetration testers
Python for Penetration testers
Christian Martorella
 
COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?Lloyd Huang
 
Make PHP Extension
Make PHP ExtensionMake PHP Extension
Make PHP Extension
Nyo Chou
 
01 linux basics
01 linux basics01 linux basics
01 linux basics
Robson Levi
 

What's hot (20)

system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarsystem management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-liners
 
Devry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-filesDevry cis-170-c-i lab-7-of-7-sequential-files
Devry cis-170-c-i lab-7-of-7-sequential-files
 
Getting help in RHel 7 / CentOS 7
Getting help in RHel 7 / CentOS 7Getting help in RHel 7 / CentOS 7
Getting help in RHel 7 / CentOS 7
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell Scripting
 
Python Programming in Entertainment Industry: Coding Style
Python Programming in Entertainment Industry: Coding StylePython Programming in Entertainment Industry: Coding Style
Python Programming in Entertainment Industry: Coding Style
 
PHP 5.3
PHP 5.3PHP 5.3
PHP 5.3
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Vim Script Programming
Vim Script ProgrammingVim Script Programming
Vim Script Programming
 
Unix Programming with Perl 2
Unix Programming with Perl 2Unix Programming with Perl 2
Unix Programming with Perl 2
 
PenTest using Python By Purna Chander
PenTest using Python By Purna ChanderPenTest using Python By Purna Chander
PenTest using Python By Purna Chander
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
 
Operating Systems 2
Operating Systems 2Operating Systems 2
Operating Systems 2
 
Operating Systems 1
Operating Systems 1Operating Systems 1
Operating Systems 1
 
bash
bashbash
bash
 
Python for Penetration testers
Python for Penetration testersPython for Penetration testers
Python for Penetration testers
 
COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?
 
Make PHP Extension
Make PHP ExtensionMake PHP Extension
Make PHP Extension
 
01 linux basics
01 linux basics01 linux basics
01 linux basics
 

Similar to Introduction to python

Python for Linux System Administration
Python for Linux System AdministrationPython for Linux System Administration
Python for Linux System Administration
vceder
 
Let's Go-lang
Let's Go-langLet's Go-lang
Let's Go-lang
Luka Zakrajšek
 
Workshop presentation hands on r programming
Workshop presentation hands on r programmingWorkshop presentation hands on r programming
Workshop presentation hands on r programming
Nimrita Koul
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
Marwan Osman
 
Python for dummies
Python for dummiesPython for dummies
Python for dummies
Roberto Stefanetti
 
Python build your security tools.pdf
Python build your security tools.pdfPython build your security tools.pdf
Python build your security tools.pdf
TECHNOLOGY CONTROL CO.
 
Introduction to Python Programming | InsideAIML
Introduction to Python Programming | InsideAIMLIntroduction to Python Programming | InsideAIML
Introduction to Python Programming | InsideAIML
VijaySharma802
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAdam Getchell
 
3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib웅식 전
 
Scala fundamentals
Scala fundamentalsScala fundamentals
Scala fundamentals
Alfonso Ruzafa
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
Bartosz Kosarzycki
 
Python
PythonPython
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
Mahendra M
 
Basics of Linux Commands, Git and Github
Basics of Linux Commands, Git and GithubBasics of Linux Commands, Git and Github
Basics of Linux Commands, Git and Github
Devang Garach
 
N flavors of streaming
N flavors of streamingN flavors of streaming
N flavors of streaming
Ruslan Shevchenko
 
A Head Start on Python Language
A Head Start on Python Language A Head Start on Python Language
A Head Start on Python Language
saggi_decembre
 
Go for Rubyists
Go for RubyistsGo for Rubyists
Go for Rubyists
Luka Zakrajšek
 
Python introduction
Python introductionPython introduction
Python introductionRoger Xia
 

Similar to Introduction to python (20)

Python for Linux System Administration
Python for Linux System AdministrationPython for Linux System Administration
Python for Linux System Administration
 
Let's Go-lang
Let's Go-langLet's Go-lang
Let's Go-lang
 
Workshop presentation hands on r programming
Workshop presentation hands on r programmingWorkshop presentation hands on r programming
Workshop presentation hands on r programming
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
 
Python for dummies
Python for dummiesPython for dummies
Python for dummies
 
Python build your security tools.pdf
Python build your security tools.pdfPython build your security tools.pdf
Python build your security tools.pdf
 
Introduction to Python Programming | InsideAIML
Introduction to Python Programming | InsideAIMLIntroduction to Python Programming | InsideAIML
Introduction to Python Programming | InsideAIML
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
 
3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib3 1. preprocessor, math, stdlib
3 1. preprocessor, math, stdlib
 
Scala fundamentals
Scala fundamentalsScala fundamentals
Scala fundamentals
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
Python
PythonPython
Python
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Basics of Linux Commands, Git and Github
Basics of Linux Commands, Git and GithubBasics of Linux Commands, Git and Github
Basics of Linux Commands, Git and Github
 
N flavors of streaming
N flavors of streamingN flavors of streaming
N flavors of streaming
 
A Head Start on Python Language
A Head Start on Python Language A Head Start on Python Language
A Head Start on Python Language
 
Go for Rubyists
Go for RubyistsGo for Rubyists
Go for Rubyists
 
Python introduction
Python introductionPython introduction
Python introduction
 

Recently uploaded

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 

Recently uploaded (20)

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 

Introduction to python

  • 1. LET’S GO WITH PYTHON PREPARED BY… V.VIDHIYA BHARATHY
  • 2. ABOUT PYTHON – First appearance at 20th Feb 1991. – Developer: Python Software Foundation. – Designed By: Guido Van Rossum. – Stable Release: 2.7.14- Dec 17 3.6.4 – Dec 17 – File Extensions: .py, .pyc, .pyd, .pyo, .pyw, .pyz – Popular IDE’s: pycharm, pydev, wing IDE, komodo IDX, Eric IDE
  • 3. SPECIALITIES OF PYTHON – High level programming language. – Interpreted language. – Dynamic type system . – Automatic memory management. – Object oriented programming. – Functional and procedural programming. – Large and comprehensive standard library.
  • 4. BASIC COMMANDS – Printing output: print(), print(‘welcome’), print(“welcome”) – Getting input: input(),input(‘enter the value’) int(input(‘getting integer number’), float(input(‘getting floating number’) eval(input(‘getting input at any data type’), raw_input(‘getting input as string’)
  • 5. VARIABLES – name=‘star’  Assigning a string content to a variable – rollno=1 Assigning a integer value to a variable – Avg=92.39 Assigning a float value to a variable – Dynamic memory allocation is followed here. – We can remove the variable by “del” command – del name – Termination symbol “;” is not needed for every command but the Indentation is important.
  • 6. OPERATORS – Arithmetic operators +,-,*,/ – Identity operator  “is”, “is not” – Comparison operator <, >,!=, = – Logical operator ”and”, “or”, “not” – Membership operator ”in” – Increment or decrement is only by x=x+1 (or) x+=1 – Boolean expression  “true”, ”false”
  • 7. CONTROL STRUCTURES – Conditional Branching  if, if…else, elif s-start – Looping Statements  while and for statements e-end st-step if (): while(-----): for( I in range(s-,e-,st-)): executable statement executable executable elif(): statements statements executable statement else: default statement
  • 8. FUNCTIONS/MODULES – Two types of functions are here, they are standard library functions User defined functions – Standard library functions like math, random, time and etc… – Three ways to import the library functions: – import math – import math as m – from math import *
  • 9. USER DEFINED FUNCTION def function_name(): attributes required; #Function_call using the function name Function_name() function call # (command line)
  • 10. LIST – Collection of certain values – A=10 variable assignment – A=[10,20,30] list(ie, like array ) – List will support all data type in a single storage variable for example, B=[10,10.90,’start’] – Dynamic addition, indexing, slicing are possible
  • 11. TUPLE – A=(1,2,3,4) – The circular braces is used for tuple, and for list square braces is used. – With this tuple we can retrieve the tuple and we can do indexing and slicing but cannot do any modification into it. – This is one of the specialities in python.
  • 12. DICTIONARY – Week={1:’sun’, 2:’mon’, 3:’tue’, 4:’wed’, 5:’thu’, 6:’fri’, 7:’sat’} – The dictionary storage has two attribute in a element, that is first one is key value : corresponding value. – Retriving , deleting ,copying and updating elements can be done with this storage.