print("hello")hello
Nov-Jan 2025 batch, Vikrant Patil
Date: 20 Sep 2025
Click here for All Notes
© Vikrant Patil
Another fancy way of programming python is jupyter notebook. once you launch
jupyter from console or from start menu, a browser will be launched.
Create a new notebook. To work with notebook you need to know few key strokes.
=========== ====================================
keys action
=========== ====================================
esc+m convert the cell to markdown
esc+y convert the cell to code
shift+enter execute the cell
!command execute system command from jupyter
=========== ====================================
45
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[32], line 1 ----> 1 "45" + 5 TypeError: can only concatenate str (not "int") to str
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[44], line 1 ----> 1 len(45) # what you intend here is to find number of digit... it is not length of number TypeError: object of type 'int' has no len()
problem think about this
x = 20
y = x
x = 30
what will be value of y after execution of all the three statements?
problem Have a look at following python statements.
x = 10
y = x
x = x + 10
What will be value of y after this?
What will be value of x after executing all statements?
x = 10
y = x
y = 25
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[76], line 1 ----> 1 names[56] IndexError: list index out of range
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[100], line 1 ----> 1 point[0] = 0 # tuple is immutable object TypeError: 'tuple' object does not support item assignment
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[103], line 1 ----> 1 name[0] = "P" TypeError: 'str' object does not support item assignment
indexing is always done with square bracket
ps1 = {"name" : "phy_std1",
"place" : "place1",
"height" : 5.6}
ps2 = {"name" : "phy_std2",
"place" : "place2",
"height" : 5.7}
ch1 = {"name" : "chem_std1",
"place" : "place3",
"height" : 6.0}
ch2 = {"name" : "chem_std2",
"place" : "place4",
"height" : 6.1}
college_ = {"physics": [ps1, ps2],
"chemistry": [ch1, ch2]}{'physics': [{'name': 'phy_std1', 'place': 'place1', 'height': 5.6},
{'name': 'phy_std2', 'place': 'place2', 'height': 5.7}],
'chemistry': [{'name': 'chem_std1', 'place': 'place3', 'height': 6.0},
{'name': 'chem_std2', 'place': 'place4', 'height': 6.1}]}
for creating the objects
- for creating a list []
- for creating a tuple ()
- for creating a dictionary {}
- for creating a set {}
for accesing always use square bracket []
list => nums[0]
tuple=> point[0]
dictionary => college['physics']
problem
a cvs file stocks.csv looks like this. How will you represent this data in python using basic and collection data types learnt so far?
symbol,value,high value,low value,volume
APPLE,234.5,240.3,233.0,100
AT&T,221.6,22.5,220.0,200
IBM,125.7,127.3,123.0,50
NIKE,100.5,105.0,104.0,1000