to print the sum of two different numbers
nt (input(‘enter the first number" ))
beint(input(‘enter the second number’)
sum=a4b
print (sum)
enter the first number123
enter the second number349090
349213
ato find simple interest
int(input('enter the principal'))
nt (input(‘enter the interest rate’)
nt(input(‘enter the time in yrs*))
ST=P#R*T/100
print(SI)
enter the principal1¢000
enter the interest rate7
enter the time in yrs3
2100.8
ato calculate the area of circle
int (input(‘enter the radius'))
Area=pitr+r
print (Area)
enter the radius
NameError Traceback (nost recent call last)
in
1 fito calculate the area of circle
2 reint(input(‘enter the radius'))
> 3 Area=pitr*r
4 print (Area)
NameError: name ‘pi’ is not defined
#to calculate the area and perimeter of rectangle
int(input(‘enter the length of rectangle’))
nt (input(‘enter the breadth of rectangle’))
Area=1*b
Perimeter=2*(1+b)
print (Area, Perimeter)
enter the length of rectangle12
enter the breadth of rectangle3s
420 94
#to convert the temperature Fahrenheit degree to Centigrade degree
int(input(‘enter the temperature in fahrenheit" ))
¥=32)*5/9
print(c)
enter the temperature in fahrenheitiee
37.77777797797778
to input the marks of five subjects and calculate the total and average
Float(input(‘enter the marks of ist subject'))
float (input (‘enter the marks of 2nd subject'))s3=float(input(‘enter the marks of 3rd subject")
s4=float (input (‘enter the marks of 4th subject'))
‘sS=float (input (‘enter the marks of Sth subject'))
Total=(sits2+s3+s4+s5)
Avg=Total/5,
print(Total, Avg)
enter the marks of 1st subject9e
enter the marks of 2nd subject1?
enter the marks of 3rd subject7é
enter the marks of 4th subjectsé
enter the marks of Sth subjectiee
337.0 67.4
#to input the basic salary and calculate the gross salary
BS-int (input("enter the basic salary’)
[email protected]"BS
DA=0.2*BS
GS=BS+HR+DA
print(6s)
enter the basic salary1eeee
16000.¢
ato input any three digit number and calculate the sum of its digits
yee
nt (input(‘enter any three digit number’) #259
j+(xX10) #9
yey#((x//10)%10)
yey+((x//108) )
print(y)
enter any three digit nunber259
16
to input any three digit number and calculate the sum of its digits
nt(input("enter any three digit no.')) #%=renainder //=quotient
aexX10 #9
print(s)
enter any three digit no.259
16
to input any three digit number and calculate the multiplication of its digits
yee
nt (input(‘enter any three digit number’) #259
yeys(x810) #9
yey*((x//10)%10)
yey*((x//108) )
print(y)
enter any three digit number25s
90
4#to input any three digit number and print the sum of first and Last digits
ye
nt(input(‘enter any three digit nunber*)) #259
y+(9010) #9In [11
In [13
/=y+((x//100) )
print(y)
enter any three digit nunber259
uu
to input any four digit number and print the sum of second and second Last digits
nt (input(‘enter any four digit number')) #X=remainder //=quotient
/+((x//10)%10)
y+ ( (x//108) x26
print(y)
enter any four digit number2345
7
to input any five digit number and print the sum of first, third and Last digit
yee
nt (input("enter any five digit number')) #X=remainder //=quotient
/+(x%10)
yay+((x//100)%10)
yey+((x//10000)%10)
print(y)
enter any four digit number23456
2
to input any three digit number and print its reverse order
nt (input("enter any three digit number’)
a= (x%10)
b=((x//10)%10)
(x//120) )
print (a,b,c, sep="")
enter any three digit nunber259
952
ato input any three digit number and print the sum of cube of its digits
nt (input('enter any three digit nunber'))
a= (x18)
b=((x//10)%10)
(x//120) )
sum=(a**3+b*#34c*#3)
print (sum)
enter any three digit number25¢
133
#to input the total selling price and total profit of 15 items, find the cost price
‘TsP=int(input (‘enter total selling price of 15 items'))
TPzint(input(‘enter total profit in % of 15 items'))
cpi=(TSP*(1-TP/108) )/15
print ("Cost price of one item i
» cP1)
enter total selling price of 15 itensiee
enter total profit in % of 15 items1e
Cost price of one item is 6.0
# to input two integer values in to different variables.WAP to interchange the valu
int (input("enter number one*))
beint(input(‘enter number two"))2
box
print("a is",a)
print("b is".b)
enter number one2
enter number twod
ais 4
bis 2
# write a program to input the distance between two cities in kilometer, convert it
KM=int (input(‘enter between two cities in kiloneter'))
MekM#1600
CMeM*100
T=CM/2.54
FeI*.083333
print ("Distance in Kilometre is", KM)
print("Distance in Metre is",M)
print ("Distance in Centimetre is",CM)
print ("Distance in Inch is",I)
print("Distance in Feet is",F)
enter between two cities in kilometer100e
Distance in Kilometre is 1000
Distance in Metre is 100000¢
Distance in Centimetre is 100000000
Distance in Inch is 39370078.74015748
Distance in Feet is 3280826.771653543