1.
a=float((input('enter 1st no:')))
b=float((input('enter 2nd no:')))
print("theit sum:",a+b)
print("their difference: ",abs(a-b))
print('their product',a*b)
print('their quotient',a/b)
ans...
enter 1st no:7
enter 2nd no:9
theit sum: 16.0
their difference: 2.0
their product 63.0
their quotient 0.7777777777777778
2.a=float(input("enter the length of one side:"))
b=float(input("enter the breadth:"))
print('area:',a*b,'perimeter',2*(a+b))
ans...
enter the length of one side:6
enter the breadth:8
area: 48.0 perimeter 28.0
3.a=input('enter 1st:')
b=input('enter 2nd:')
print("numbers are :",a,b)
c=a
a=b
b=c
print('after swap:',a,b)
ans..
enter 1st:4
enter 2nd:9
numbers are : 4 9
after swap: 9 4
4.p=float(input("enter the amount:"))
t=float(input("enter the time in days:"))
r=float(input("enter the rate of interest per day:"))
print("so the interest:",p*r*t/100)
ans...
enter the amount:100
enter the time in days:0.9
enter the rate of interest per day:8
so the interest: 7.2
5.c=float(input("enter temperature in celcius:"))
print("temperature in fahrenheit:",(9/5)*c+32)
ans...
enter temperature in celcius:100
temperature in fahrenheit: 212.0
6.def f(a,b,c):
d=a
if b>=a:
d=b
if c>=b:
d=c
return d
print("max one is",f(7,8,9))
ans...
max one is 9
7.a=int(input("enter an integer number:"))
if a%2==0:
print("it's even")
else:
print("its odd")
ans...
enter an integer number:5
its odd
8.a=input("enter a 3 digit number:")
print("the sum of all the digits:",int(a[0])+int(a[1])+int(a[2]))
ans...
enter a 3 digit number:487
the sum of all the digits: 19
9.def fact(n):
s=1
if n==0 or n==1:
return 1
else :
for i in range(1,n+1):
s=s*i
return s
n=int(input("enter one positive integer:"))
print(fact(n))
ans...
enter one positive integer:6
720
10.n=int(input("enter a number to print its multiplication table:"))
for i in range(1,11):
print(n,'x',i,'=',n*i)
ans...
enter a number to print its multiplication table:15
15 x 1 = 15
15 x 2 = 30
15 x 3 = 45
15 x 4 = 60
15 x 5 = 75
15 x 6 = 90
15 x 7 = 105
15 x 8 = 120
15 x 9 = 135
15 x 10 = 150