Introduction to Python
Why use python?
• Less code
• Pre-build libraries
• Platform Independent (run multiple platform)
• Ease to learning (simple syntax)
• Massive community support
Python installation
• [Link]
• Professional IDE:
– [Link]
section=windows
• IDE:
– [Link]
– [Link]
• Anaconda Navigator (GUI)
• Anaconda Prompt (type jupyter notebook)
Jupyter Notebook
New + python 3 , .ipymb, Execute code by kernal
First program
• print(“this is first program”)
Variable in Python
Variable in memory
Name of variable
Value of variable
Value can be
changed
Address of variable
Example
Data Type
Tokens
Operators in Python
Comment #
Keywords
Represented as Green Color
Identifiers
Literals
Do not change the value…
value stored in variable is
literals….
a is variable and “hello world“ is literals, can not
change it…..
String
‘Hello World’
“Hello World”
“’Hello World’”
Value at 11 : exclusive
Included 5 to 10 only….
String divides into three part
Split after every “e”
Can not change
after creation
Store multiple element of different type in
order
tup1 is an object.
Index
Modification is
possible in List after
creation
Difference between list and tuple:
List is mutable, tuple is immutable
List uses [ ] and tuple uses ()
Methods : append() and pop()
Apple is key and 10 is value
It can be modified
Append in fruit1
Not extract with index
It is mutable
Insert in random position due to unordered collection
Pass list of element
Combine
Common
Flow Control Statements
Decision making statement
True
False
Indentation or space
Error
If with tuple
If with list If with dictionary
While and For loop
While with List
Data structures
Iterate over sequence of element (sequence)
Thank you