0% found this document useful (0 votes)
25 views

3) Python Fundamentals - Jupyter Notebook

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

3) Python Fundamentals - Jupyter Notebook

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

8/5/23, 7:11 PM Python Fundamentals - Jupyter Notebook

Variables
In [7]: a = 5
a

Out[7]: 5

In [9]: type(a)

Out[9]: int

In [13]: sourav = "My name is Sourav"


sourav

Out[13]: 'My name is Sourav'

In [14]: type(sourav)

Out[14]: str

In [15]: abc = 123


abc

Out[15]: 123

In [16]: a b c = 123
a

File "C:\Users\HP\AppData\Local\Temp/ipykernel_18116/2667476975.py", line 1


a b c = 123
^
SyntaxError: invalid syntax

localhost:8888/notebooks/1-Pregrad_Aug_batch/Python Fundamentals.ipynb 1/7


8/5/23, 7:11 PM Python Fundamentals - Jupyter Notebook

In [17]: a b c = 1 2 3
a b c

File "C:\Users\HP\AppData\Local\Temp/ipykernel_18116/1863676837.py", line 1


a b c = 1 2 3
^
SyntaxError: invalid syntax

In [22]: a, b , c = 1, 'string data', 3.5


a, b, c

Out[22]: (1, 'string data', 3.5)

In [23]: type(a)

Out[23]: int

In [24]: type(b)

Out[24]: str

In [25]: type(c)

Out[25]: float

In [28]: print(type(a))
print(type(b))
print(type(c))

<class 'int'>
<class 'str'>
<class 'float'>

In [ ]: ​

localhost:8888/notebooks/1-Pregrad_Aug_batch/Python Fundamentals.ipynb 2/7


8/5/23, 7:11 PM Python Fundamentals - Jupyter Notebook

In [31]: a = 5.2
a = 5

type(a)

Out[31]: int

In [ ]: ​

In [32]: lst = [2,4,65,7,9,6,9,5,6]


lst

Out[32]: [2, 4, 65, 7, 9, 6, 9, 5, 6]

In [33]: len(lst)

Out[33]: 9

In [34]: type(lst)

Out[34]: list

In [ ]: ​

Identifires
In [35]: _sourav = 14
_sourav

Out[35]: 14

In [37]: _12any = 1.6


_12any

Out[37]: 1.6

localhost:8888/notebooks/1-Pregrad_Aug_batch/Python Fundamentals.ipynb 3/7


8/5/23, 7:11 PM Python Fundamentals - Jupyter Notebook

In [38]: 65abc = 1
65abc

File "C:\Users\HP\AppData\Local\Temp/ipykernel_18116/2169966098.py", line 1


65abc = 1
^
SyntaxError: invalid syntax

In [39]: ab_12_ = 56
ab_12_

Out[39]: 56

In [52]: sasdbjdjsbdssbckjsdckjsdkcbskjcbks = 15
sasdbjdjsbdssbckjsdckjsdkcbskjcbks

Out[52]: 15

In [ ]: ​

In [ ]: ​

In [ ]: ​

Keywords

localhost:8888/notebooks/1-Pregrad_Aug_batch/Python Fundamentals.ipynb 4/7


8/5/23, 7:11 PM Python Fundamentals - Jupyter Notebook

In [40]: if = 5
if

File "C:\Users\HP\AppData\Local\Temp/ipykernel_18116/2094776061.py", line 1


if = 5
^
SyntaxError: invalid syntax

In [41]: for = 3.5


for

File "C:\Users\HP\AppData\Local\Temp/ipykernel_18116/3659034976.py", line 1


for = 3.5
^
SyntaxError: invalid syntax

In [42]: elif = [2,5,7,8,9]


elif

File "C:\Users\HP\AppData\Local\Temp/ipykernel_18116/1038809614.py", line 1


elif = [2,5,7,8,9]
^
SyntaxError: invalid syntax

In [ ]: ​

Comments

localhost:8888/notebooks/1-Pregrad_Aug_batch/Python Fundamentals.ipynb 5/7


8/5/23, 7:11 PM Python Fundamentals - Jupyter Notebook

In [51]: a = 5
b = 6
sss = 5

sss

Out[51]: 5

In [55]: # Single Line Comment



a = 5
b = 6

c = a + b # Here we have assigned a third variable C to add the previous variables number
c

Out[55]: 11

In [ ]: ​

In [57]: """
hello
world
how
are
you

"""

aa = 66
aa

Out[57]: 66

localhost:8888/notebooks/1-Pregrad_Aug_batch/Python Fundamentals.ipynb 6/7


8/5/23, 7:11 PM Python Fundamentals - Jupyter Notebook

In [58]: """

first - define a variable a, including value 5
second - define a variable b, including value 6

then asigned third variable c

and Add them

"""


a = 5
b = 6

c = a + b
c

Out[58]: 11

In [ ]: ​

In [ ]: ​

localhost:8888/notebooks/1-Pregrad_Aug_batch/Python Fundamentals.ipynb 7/7

You might also like