SlideShare a Scribd company logo
1 of 23
Download to read offline
Short, Unique and Mysterious
Why is the
Programming
Language
named so?
Q
Monty
Python's
Flying Circus
a
"A t t h e t i m e w h e n h e b e g a n
implementing Python, Guido van
R o s s u m w a s a l s o re a d i n g t h e
published scripts from "Monty
Python's Flying Circus" (a BBC
comedy series from the seventies, in
the unlikely case you didn't know).
It occurred to him that he needed a
name that was short, unique, and
slightly mysterious, so he decided
to call the language Python."
-Charlie Cheever
(Quora User & Founder)
Guido van
Rossum
“
”
Q What should I
know before
starting?
a
PYTHON
I
Interpreted
Interactive
Object Oriented
??
Beginner friendly
C++
Unix shell
SmallTalk
PYTHON
a BUILDING BLOCKS of PYTHON
Note - The placement of Building blocks has no relevance for dependent blocks
C
ABC Modula-3
CONTENTS
Installation & Configuration
Learning Basics
>>> Python I & S
Quick Exercise
• In latest LTS version of Ubuntu 16.04, Python comes installed with OS.
Make sure you've updated version before starting
• To check the version of Python installed using following command on
terminal
python --version
• In order to update you must perform foll. steps
Open web browser and go to
https://www.python.org/downloads/
Download appropriate Source file as per OS & Extract files
Run ./configure script in terminal of with respect to your
extracted location, then use make & make install
$
Installation & Configuration
SETTING UP PATH:
• Programs and other executable files can be in many directories, so
operating systems provide a search path that lists the directories that
the OS searches for executables.
• The path is stored in an environment variable, which is a named
string maintained by the operating system. This variable contains
information available to the command shell and other programs.
• The path variable is named as PATH in Unix or Path in Windows
(Unix is case-sensitive; Windows is not).
Type in Terminal: (Ctrl + Alt + T)
export ATH="$PATH:/usr/local/bin/python" and press Enter.
Installation & Configuration
$
IDE: IDLE, PyCharm
Interpreted & Interactive Mode: Open and type in python or
python3 in case you've updated
Learning Basics
RUNNING PYTHON
$
Learning Basics
There are slight differences from version to version, and are not majorly
changed with respect to syntax.
Remember - Python is a Case-sensitive language
>>> Python I & S
• The three closed angular brackets at the beginning of every line is the
Python prompt
• It marks the beginning of the Interpreter
EXERCISE:
Type following in Interpreter mode of python
a = "Hello" # Assiging of values
b = "Python"
print(a, b)
'''
Printing does not require
format specifier
'''
and observe the output.
• The Interpreter mode is easy and fast enough to execute line by
line, but when it comes to one monolithic programming logic we go
for writing Scripts.
• It is similar the way we have been writing programs for C++ & Java.
>>> Python I & S
#!/usr/lib/python3.5
a = 3
b = 7
print("Multiplication of 3 * 7 = ",a * b)
multiply.py
>>> Python I & S
DATA TYPES:
• Numbers/Integers........(0, -1, 34, 2.1, 10065e, 10222.122254L)
• String.......................................(Hello world, Sum=, Enter value)
• List...........................................................(Grocery list, to do list)
• Dictionary...................................(a:First Letter, b:Second Letter)
• Tuple.............................................(List of Marks, Race records)
EXERCISE:
Type following in Script Mode
uname = first_name = "Emily"
pass = "password"
print("Your Credentials are UN",uname," PW",pass)
and execute the script
ASSIGNING VALUES:
• A well understood paradigm in programming of assigning values to
variables is much easier in Python
• Foll. the given examples-
① Name = "Lord Snow"
② Year = 2017
③ Birth = Death = "Undecided"
• Strings needs to be written in either Single Quotes (' ') or Double Quotes
(" ") to save it as a string
• Number can be assigned plainly, & can be integer or float
• Multiple assignments is easily possible in transitive manner
>>> Python I & S
>>> Python I & S
RESERVED WORDS:
and exec not
assert finally or
break for pass
class from print
continue global raise
def if return
del import try
elif in while
else is with
except lambda yield
IDENTIFIERS:
1. Class names - All classname's must initiate with Uppercase letters.
• Eg- Add, Round, Animate
1. Private - A private identifier must begin with an underscore "_".
• Eg - _varA, _varB
1. Strongly Private - A Strongly private identier initiates with double
underscores "__".
• Eg - __varC, __Add
1. Special Names - There exists q set of names which initiate and end
with doube underscores denoting it as a name with special meaning.
• Eg - __init__
>>> Python I & S
Quick Exercise
Try the following in Python Interpreter:
>>> 5+4 >>> 5-4
9 1
>>> 5*4 >>> 5**4
20 625
>>> 5/4 >>> -5/4
1.25 -1.25
>>> 5%4 >>> -5%4
1 3
Exponential
operation: 54
Integer division
rounds down
remainder (mod)
division returns 0
or positive
INTEGERS
Quick Exercise
>>> 65536*65536 >>> 4294967296*4294967296
65536 18446744073709551616L
No inherent limit to Python's integer arithmetic:
can keep going until we run out of memory
Note: Long (L) is discontinued since Python 3.X
FLOATING POINT
Quick Exercise
>>> 1.0 Floating point number
1.0 (& usual issues with them)
>>> 1/2
0.5 Ok
>>> 1/4
0.25 Ok
>>> 0.1
0.10000000000000001 Issues with representation in
base 2 (Altough it has been covered from Python 2.7
onwards)
Quick Exercise
TESTING ACCURACY
>>> 65536.0*65536.0
4294967296.0
>>> 4294967296.0*4294967296.0
1.8446744073709552e+19
Accuracy of upto 16 places after Decimal
>>> 1.157920892373162e+77*1.157920892373162e+77
1.3407807929942597e+154
>>> 1.3407807929942597e+154 *
1.3407807929942597e+154
inf
>>> 1.0 + 1.0e-16 Too small to make
1.0 a difference
>>> 1.0 + 2.0e-16 Large enough, hence
1.0000000000000002 more precision
>>> 1.0 + 1.1e-16
1.0
>>> 1.0 + 1.9e-16
1.0000000000000002
Quick Exercise
'e' - Means
9.0122222900391 × 10−5
MACHINE EPSILON
To Be Resumed in Next Slide
/mITuSkillologies @mitu_group

More Related Content

Similar to python program

Python - Introduction
Python - IntroductionPython - Introduction
Python - Introductionstn_tkiller
 
1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt1B-Introduction_to_python.ppt
1B-Introduction_to_python.pptAmritMarwaha1
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdfgmadhu8
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPTShivam Gupta
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdfsamiwaris2
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3aRuth Marvin
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxlemonchoos
 
GE3151- PYTHON PROGRAMMING ANNA UNI.pptx
GE3151- PYTHON PROGRAMMING ANNA UNI.pptxGE3151- PYTHON PROGRAMMING ANNA UNI.pptx
GE3151- PYTHON PROGRAMMING ANNA UNI.pptxReshmaR57
 
Lecture1_introduction to python.pptx
Lecture1_introduction to python.pptxLecture1_introduction to python.pptx
Lecture1_introduction to python.pptxMohammedAlYemeni1
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughgabriellekuruvilla
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Mohan Arumugam
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialJustin Lin
 
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptxsangeeta borde
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unitmichaelaaron25322
 

Similar to python program (20)

Python - Introduction
Python - IntroductionPython - Introduction
Python - Introduction
 
05 python.pdf
05 python.pdf05 python.pdf
05 python.pdf
 
1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt1B-Introduction_to_python.ppt
1B-Introduction_to_python.ppt
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
 
python_class.pptx
python_class.pptxpython_class.pptx
python_class.pptx
 
Python
PythonPython
Python
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3a
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
GE3151- PYTHON PROGRAMMING ANNA UNI.pptx
GE3151- PYTHON PROGRAMMING ANNA UNI.pptxGE3151- PYTHON PROGRAMMING ANNA UNI.pptx
GE3151- PYTHON PROGRAMMING ANNA UNI.pptx
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Lecture1_introduction to python.pptx
Lecture1_introduction to python.pptxLecture1_introduction to python.pptx
Lecture1_introduction to python.pptx
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 Tutorial
 
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 

Recently uploaded

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 

Recently uploaded (20)

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 

python program

  • 1. Short, Unique and Mysterious
  • 3. Monty Python's Flying Circus a "A t t h e t i m e w h e n h e b e g a n implementing Python, Guido van R o s s u m w a s a l s o re a d i n g t h e published scripts from "Monty Python's Flying Circus" (a BBC comedy series from the seventies, in the unlikely case you didn't know). It occurred to him that he needed a name that was short, unique, and slightly mysterious, so he decided to call the language Python." -Charlie Cheever (Quora User & Founder) Guido van Rossum “ ”
  • 4. Q What should I know before starting?
  • 6. C++ Unix shell SmallTalk PYTHON a BUILDING BLOCKS of PYTHON Note - The placement of Building blocks has no relevance for dependent blocks C ABC Modula-3
  • 7. CONTENTS Installation & Configuration Learning Basics >>> Python I & S Quick Exercise
  • 8. • In latest LTS version of Ubuntu 16.04, Python comes installed with OS. Make sure you've updated version before starting • To check the version of Python installed using following command on terminal python --version • In order to update you must perform foll. steps Open web browser and go to https://www.python.org/downloads/ Download appropriate Source file as per OS & Extract files Run ./configure script in terminal of with respect to your extracted location, then use make & make install $ Installation & Configuration
  • 9. SETTING UP PATH: • Programs and other executable files can be in many directories, so operating systems provide a search path that lists the directories that the OS searches for executables. • The path is stored in an environment variable, which is a named string maintained by the operating system. This variable contains information available to the command shell and other programs. • The path variable is named as PATH in Unix or Path in Windows (Unix is case-sensitive; Windows is not). Type in Terminal: (Ctrl + Alt + T) export ATH="$PATH:/usr/local/bin/python" and press Enter. Installation & Configuration $
  • 10. IDE: IDLE, PyCharm Interpreted & Interactive Mode: Open and type in python or python3 in case you've updated Learning Basics RUNNING PYTHON $
  • 11. Learning Basics There are slight differences from version to version, and are not majorly changed with respect to syntax. Remember - Python is a Case-sensitive language
  • 12. >>> Python I & S • The three closed angular brackets at the beginning of every line is the Python prompt • It marks the beginning of the Interpreter EXERCISE: Type following in Interpreter mode of python a = "Hello" # Assiging of values b = "Python" print(a, b) ''' Printing does not require format specifier ''' and observe the output.
  • 13. • The Interpreter mode is easy and fast enough to execute line by line, but when it comes to one monolithic programming logic we go for writing Scripts. • It is similar the way we have been writing programs for C++ & Java. >>> Python I & S #!/usr/lib/python3.5 a = 3 b = 7 print("Multiplication of 3 * 7 = ",a * b) multiply.py
  • 14. >>> Python I & S DATA TYPES: • Numbers/Integers........(0, -1, 34, 2.1, 10065e, 10222.122254L) • String.......................................(Hello world, Sum=, Enter value) • List...........................................................(Grocery list, to do list) • Dictionary...................................(a:First Letter, b:Second Letter) • Tuple.............................................(List of Marks, Race records)
  • 15. EXERCISE: Type following in Script Mode uname = first_name = "Emily" pass = "password" print("Your Credentials are UN",uname," PW",pass) and execute the script ASSIGNING VALUES: • A well understood paradigm in programming of assigning values to variables is much easier in Python • Foll. the given examples- ① Name = "Lord Snow" ② Year = 2017 ③ Birth = Death = "Undecided" • Strings needs to be written in either Single Quotes (' ') or Double Quotes (" ") to save it as a string • Number can be assigned plainly, & can be integer or float • Multiple assignments is easily possible in transitive manner >>> Python I & S
  • 16. >>> Python I & S RESERVED WORDS: and exec not assert finally or break for pass class from print continue global raise def if return del import try elif in while else is with except lambda yield
  • 17. IDENTIFIERS: 1. Class names - All classname's must initiate with Uppercase letters. • Eg- Add, Round, Animate 1. Private - A private identifier must begin with an underscore "_". • Eg - _varA, _varB 1. Strongly Private - A Strongly private identier initiates with double underscores "__". • Eg - __varC, __Add 1. Special Names - There exists q set of names which initiate and end with doube underscores denoting it as a name with special meaning. • Eg - __init__ >>> Python I & S
  • 18. Quick Exercise Try the following in Python Interpreter: >>> 5+4 >>> 5-4 9 1 >>> 5*4 >>> 5**4 20 625 >>> 5/4 >>> -5/4 1.25 -1.25 >>> 5%4 >>> -5%4 1 3 Exponential operation: 54 Integer division rounds down remainder (mod) division returns 0 or positive INTEGERS
  • 19. Quick Exercise >>> 65536*65536 >>> 4294967296*4294967296 65536 18446744073709551616L No inherent limit to Python's integer arithmetic: can keep going until we run out of memory Note: Long (L) is discontinued since Python 3.X
  • 20. FLOATING POINT Quick Exercise >>> 1.0 Floating point number 1.0 (& usual issues with them) >>> 1/2 0.5 Ok >>> 1/4 0.25 Ok >>> 0.1 0.10000000000000001 Issues with representation in base 2 (Altough it has been covered from Python 2.7 onwards)
  • 21. Quick Exercise TESTING ACCURACY >>> 65536.0*65536.0 4294967296.0 >>> 4294967296.0*4294967296.0 1.8446744073709552e+19 Accuracy of upto 16 places after Decimal >>> 1.157920892373162e+77*1.157920892373162e+77 1.3407807929942597e+154 >>> 1.3407807929942597e+154 * 1.3407807929942597e+154 inf
  • 22. >>> 1.0 + 1.0e-16 Too small to make 1.0 a difference >>> 1.0 + 2.0e-16 Large enough, hence 1.0000000000000002 more precision >>> 1.0 + 1.1e-16 1.0 >>> 1.0 + 1.9e-16 1.0000000000000002 Quick Exercise 'e' - Means 9.0122222900391 × 10−5 MACHINE EPSILON
  • 23. To Be Resumed in Next Slide /mITuSkillologies @mitu_group