Professional Documents
Culture Documents
n=1
while(n<6):
print('5 * ',n,'=',5*n)
n=n+1
2)
n=1
while(n<10):
print(n,end=',')
n=n+1
3)
n=1
while(n<10):
print(n,end=' ')
n=n+1
n=0
while(n<11):
print("Square of n",n*n)
n=n+1
5)Write a python program to find the sum of all even numbers from 0 to 10
n=2
c=0
while(n<11):
c=c+n
n=n+2
total=0
list=[12,23,456,67]
list=[1,34,56,78,998,3456]
if "is" in test_str :
print ("Yes, ‘is’ present in str1")
else :
9) Write a python program to design simple calculator performing arithmetic functions like addition, subtraction,
multiplication and division with the input given by user
return x + y
return x - y
return x * y
return x / y
print("Select operation.")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
if choice == '1':
print(num1,"+",num2,"=", add(num1,num2))
print(num1,"-",num2,"=", subtract(num1,num2))
print(num1,"*",num2,"=", multiply(num1,num2))
else:
print("Invalid input")
i=0
s=0
while i<n:
s=s+i
i=i+1
i)Maxima ii)minima iii)sum of two tuples iv) duplicate a tuple v)slicing operator vi) obtaining a list from a tuple vii)
Compare two tuples viii)printing two tuples of different data types
tup1,tup2=(24,432,122,23),(125,567,887,12)
tup3=tup2
print("Comparison of tuples")
if (tup1>tup2):
print("tup1 is bigger")
else:
print("tup2 is bigger")
tup4=("Appu",123,'apple',12.33)
print(tup4)
list=[2,3,5,77,8,85,876]
e=0
o=0
if num%2==0:
e=e+1
else:
o=o+1