Professional Documents
Culture Documents
1 Lab
>>> type(1)
<class 'int'>
>>> type(15)
<class 'int'>
>>> type(0)
<class 'int'>
>>> type(-46)
<class 'int'>
>>> type(4.5)
<class 'float'>
>>> type(5.8)
<class 'float'>
>>> type(2342423424.3)
<class 'float'>
>>> type(4.0)
<class 'float'>
>>> type(0.0)
<class 'float'>
>>> type(-23.5)
<class 'float'>
>>> complex(4, 5)
(4+5j)
>>> complex(6, 8)
(6+8j)
>>> complex(3.4, 3.4)
(3.4+3.4j)
>>> complex(0, 0)
0j
>>> complex(5)
(5+0j)
>>> complex(0, 4)
4j
>>> my_string = "Hello"
>>> my_string[0]
'H'
>>> my_string[1]
'e'
>>> my_string[2]
'l'
>>> my_string[3]
'l'
>>> my_string[4]
'o'
>>> my_string = "Hello"
>>> my_string[-1]
'o'
>>> my_string[-2]
'l'
>>> my_string[-3]
'l'
>>> my_string[-4]
'e'
>>> my_string[-5]
'H'
>>>name="Rajeev Ranjan Kumar Trtipathi"
name[0:24:2]
'Rje ajnKmrTt'
>>>name[:8]
'Rajeev R'
else:
print("Number is not there in the array")
b=[1,2,3,4,5]
fir=0
las=len(b)
term=4
binary(b,fir,las,term)
print("Average=", avg)
for i in range(n):
for j in range(0,n-i-1):
if arr[j]>arr[j+1]:
temp=arr[j+1]
arr[j+1]=arr[j]
arr[j]=temp
print("Sorted Array : ", arr )