Pytho1 Merged
Pytho1 Merged
Pytho1 Merged
8
Out[1]:
In [6]: 5//2
2
Out[6]:
In [1]: 7-8
-1
Out[1]:
In [2]: 4*-1
-4
Out[2]:
In [7]: 5%2
1
Out[7]:
In [ ]: 1**8
In [3]: 2+2
4
Out[3]:
In [4]: 3**2
9
Out[4]:
In [1]: 12345*4
49380
Out[1]:
In [4]: 12345**82
317884776440926673316071144851267647505713184000319533419755476728729105289309145704229294603789231584874559943732064673188194277677922822925225294346846070500060102317287246920101
Out[4]:
014103953447930169920339992337607012463791675200187266268128397859578982107088447500892836467449524011782166664692207691533809565953561104834079742431640625
In [2]: 3/2
1.5
Out[2]:
In [5]: 2+2*5
12
Out[5]:
In [8]: 'hELP'
'hELP'
Out[8]:
In [9]: 2+3;3+3
6
Out[9]:
In [10]: "hELLO"
'hELLO'
Out[10]:
(3, 'Hello')
Out[12]:
'HealLord'
Out[13]:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [14], in <cell line: 1>()
----> 1 "Heal" - "al"
In [20]: 'A123'+'123'
'A123123'
Out[20]:
5
1
Out[24]:
In [34]: d=1+5
e=3+4
d
6
Out[34]:
In [ ]:
In [ ]:
In [1]: type(90.89)
float
Out[1]:
In [2]: type(9)
int
Out[2]:
In [3]: type("sdf")
str
Out[3]:
In [4]: type(Telegram)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 type(Telegram)
In [5]: int 12
Input In [5]
int 12
^
SyntaxError: invalid syntax
In [6]: name="print"
nam=print
a=8
b=2,2
print(name)
print(nam)
print(a)
print(b)
print
<built-in function print>
8
(2, 2)
In [7]: name="print"
nam="printad"
a=8
b=2.2
print(name)
print(nam)
print(a)
print(b)
print
printad
8
2.2
In [22]: name="print"
nam="printad"
a=8
b=2.2
print(name, "\t and \t" , nam, "\n" ,a, "\n" , b) #use comma
In [9]: name="print"
nam="printad"
a=8
b=2.2
print("name:", name, "\n" "number:" ,a)
name: print
number: 8
In [10]: type("true")
str
Out[10]:
In [11]: nam1="Heal"
nam2=" the World"
print(nam1+nam2)
In [21]: v='123'
x=float(v)
y=int(v)
print(x, "\n", y) #use comma
123.0
123
In [19]: x=1;y=2;
print(x+y)
print(x-y)
print(x*y)
print(x/y)
print(x%y)
print(x**y)
3
-1
2
0.5
1
1
l=10; b=20;
print("area of rectangle:\t=" , l*b)
Sum:
= 30
enter number:5
square= 25
sum of 10 and 5 is 15
In [20]: side=6.0;
area=side*side;
print("Area of the square of side %f = %f" %(side,area))#%f because the area is in float format
In [23]: side=6.0;
area=side*side;
print("Area of the square of side %f = %f" %(side,area))#%f because the area is in float format
print("Area of the square of side", side, "=", area)
In [35]: #dot
print('{0},{2},{1}'.format("Maria","Kerala",562001))
Maria,562001,Kerala
In [37]: #dot
print('{0},{1},{other}'.format("Maria","Kerala",other=562001))
Maria,Kerala,562001
In [39]: n="tom"
reg=123456;
print('my name and reg is:{} and {}'.format(n,reg))
In [41]: print("name{0}, batch{1:d}, per{2:0.2f}".format('rahul',2021,71.3000)) #d for int, f for float, 2:0 2 decimal place
In [ ]:
In [ ]: