001-b Code
001-b Code
Hello World
Venky
Hello World Venky
[ ]: # use case of end
Hello World
Venky
[ ]: print("Hello World\n")
print("Venky")
Hello World
Venky
Hello
Venky
Gate
1
[ ]: print("Welcome to RBR Course", "This is Venky", sep="++", end="***")
print("Checkout to this course", end="\n\n")
print("Python programming")
Python programming
0.1 Variables
[ ]: 2+3
[ ]: 5
[ ]: 4+5
[ ]: 9
v = 100000
[ ]: v - 10000
[ ]: 90000
[ ]: v+12000
[ ]: 112000
[ ]: value = 100
id(value)
[ ]: 137443867102544
[ ]: type(value)
[ ]: int
[ ]: a = 100
id(a)
[ ]: 137443867102544
2
[ ]: a = 100
b = 100
print(id(a))
print(id(b))
print("After Changing")
b = b+20
print("b:", b)
print(id(a))
print(id(b))
a = 120
print(id(a))
137443867102544
137443867102544
After Changing
b: 120
137443867102544
137443867103184
137443867103184
[ ]: del a
[ ]: print(b)
print(id(b))
120
137443867103184
[ ]: f = 12.5
print(f)
print(type(f))
print(id(f))
12.5
<class 'float'>
137442585477424
[ ]: n8ame = "venky"
[ ]: name = "Venky"
Name = "RBR"
NAME = "Jay Bansal"
3
NAME_2 = "Venky"
print(name)
print(id(name))
print(Name)
print(id(Name))
print(NAME)
print(id(NAME))
print(id(NAME_2))
Venky
137442586806832
RBR
137442586812528
Jay Bansal
137442584224304
137442586806832
[ ]: name = "Venky"
name_2 = "VENKY"
print(id(name))
print(id(name_2))
137442586806832
137442585736176
[ ]: name = "Venky"
name.removeprefix("Ven")
[ ]: 'ky'
[ ]: k = 4/2
i = 2.0
i == k
[ ]: True
[ ]: id(i)
[ ]: 136008100513008
[ ]: id(k)
[ ]: 136008100513552
4
[ ]: k
[ ]: 2.0
[ ]: i
[ ]: 2.0
[ ]: k = 4//2
i = 2
id(k)
[ ]: 136009076605200
[ ]: id(i)
[ ]: 136009076605200
[ ]: k = 12345
m = 12345
id(k)
[ ]: 136008100511920
[ ]: id(12)
[ ]: 136009076605520
[ ]: 136009076605520-136009076605456
[ ]: 64
[ ]: id(10)
[ ]: 136009076605456
[ ]: Decimal('0.3000000000000000444089209850062616169452667236328125')
[ ]: vn = Decimal(0.1)+Decimal(0.2)
vn
[ ]: Decimal('0.3000000000000000166533453694')
5
[ ]: v = 0.5
n = 0.5
id(v)
[ ]: 136008100519824
[ ]: id(n)
[ ]: 136008100521584
[ ]: v = n
id(v)
[ ]: 136008100521584
[ ]: id(n)
[ ]: 136008100521584
[ ]: v = 1
n = 1
id(v)
[ ]: 136009076605168
[ ]: import decimal
a = decimal.Decimal('1.1')
b = decimal.Decimal('2.2')
c = a+b
print(c)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-102-2bd55a2c550f> in <cell line: 7>()
5
6 c = a+b
----> 7 print(c)
[ ]: id(n)
[ ]: 136009076605168
6
[ ]: id(n)
[ ]: 136008100521936
[ ]: Decimal(0.5)
[ ]: Decimal('0.5')
[ ]: import keyword
keyword.kwlist
[ ]: ['False',
'None',
'True',
'and',
'as',
'assert',
'async',
'await',
'break',
'class',
'continue',
'def',
'del',
'elif',
'else',
'except',
'finally',
'for',
'from',
'global',
'if',
'import',
'in',
'is',
'lambda',
'nonlocal',
'not',
'or',
'pass',
'raise',
'return',
'try',
'while',
'with',
'yield']
7
[ ]: a = None
b = None
a==b
[ ]: True
[ ]: print(type(a))
print(type(b))
<class 'NoneType'>
<class 'NoneType'>
<class 'NoneType'>
<class 'NoneType'>
[ ]: 0.1
[ ]: 0.1