6/12/24, 7:46 PM 12-06-2024 - Jupyter Notebook
In [1]: 1 print("data analysis workshop")
data analysis workshop
In [2]: 1 print('python')
python
In [4]: 1 print('57923*^*()')
57923*^*()
In [9]: 1 # how to print keywords in python
2 import keyword
3 print([Link])
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'brea
k', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finall
y', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonloc
al', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yiel
d']
In [10]: 1 # length of the keywords
2 import keyword
3 print(len([Link]))
35
comments
single line comment
multiline comment
In [13]: 1 # - single line comment
2 # print('hello world')
3 print('hiii')
hiii
In [1]: 1 # multiline comment
2 '''jytuytuy
3 hgyugyugtuy
4 uituytuytuyyu
5 '''
6 print('hii')
hii
1 - Variable
2 - which is used to store the data
3
4 - Rules
5 - Should starts with alphabets
6 - Shouldn't starts with digits and special symbols except
localhost:8888/notebooks/Music/Data Analysis Internship- 2024/[Link] 1/6
6/12/24, 7:46 PM 12-06-2024 - Jupyter Notebook
7 (_) underscore
8 - Shouldn't use keywords as variable names
9 - Shouldn't use spaces
In [2]: 1 a = 7
2 a
Out[2]: 7
In [4]: 1 a5 = 89
2 a5
Out[4]: 89
In [6]: 1 _g = 75
2 _g
Out[6]: 75
In [7]: 1 True = 6
2 True
File "<ipython-input-7-44f9c9a63843>", line 1
True = 6
^
SyntaxError: can't assign to keyword
In [9]: 1 a_b = 8
2 a_b
Out[9]: 8
In [13]: 1 a,b,c=8,9,4
2 print(a,b,c)
8 9 4
1 - Datatypes
2 - int - 67,89,236546
3 - float - 8.9,5.9,4.9......
4 - str - 'a','python'
5 - bool - True,False
6 - complex - a+bj
In [14]: 1 # integer
2 # static way of input
3 s = 78687687
4 s
Out[14]: 78687687
localhost:8888/notebooks/Music/Data Analysis Internship- 2024/[Link] 2/6
6/12/24, 7:46 PM 12-06-2024 - Jupyter Notebook
In [15]: 1 f = 78.8
2 f
Out[15]: 78.8
In [21]: 1 h = 89.8
2 print(type(h))
<class 'float'>
In [19]: 1 d = int(input('enter any number: '))
2 d
enter any number: 67
Out[19]: 67
In [23]: 1 f = float(input())
2 f
7656
Out[23]: 7656.0
In [24]: 1 g = str(input())
2 g
vanitha
Out[24]: 'vanitha'
In [25]: 1 g1 = input()
2 g1
python
Out[25]: 'python'
In [26]: 1 j = complex(input())
2 j
Out[26]: (8+0j)
In [ ]: 1 - Type Conversions
2
3 - syntax
4
5 - int - int(variable_name)
6 - float - float(variable_name)
7 - str - str(variable_name)
8
localhost:8888/notebooks/Music/Data Analysis Internship- 2024/[Link] 3/6
6/12/24, 7:46 PM 12-06-2024 - Jupyter Notebook
In [28]: 1 # int to float
2 a = 7
3 print(a,type(a))
4 a1 = float(a)
5 print(a1,type(a1))
7 <class 'int'>
7.0 <class 'float'>
In [29]: 1 # float to integer
2 f = 8.9
3 print(f,type(f))
4 f1 = int(f)
5 print(f1,type(f1))
8.9 <class 'float'>
8 <class 'int'>
In [30]: 1 # int to str
2 j = 899
3 print(j,type(j))
4 h = str(j)
5 print(h,type(h))
899 <class 'int'>
899 <class 'str'>
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
localhost:8888/notebooks/Music/Data Analysis Internship- 2024/[Link] 4/6
6/12/24, 7:46 PM 12-06-2024 - Jupyter Notebook
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
localhost:8888/notebooks/Music/Data Analysis Internship- 2024/[Link] 5/6
6/12/24, 7:46 PM 12-06-2024 - Jupyter Notebook
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
In [ ]: 1
localhost:8888/notebooks/Music/Data Analysis Internship- 2024/[Link] 6/6