PROGRAM 1
#Write a program of arithmetic operators +,-,*,/,%,** exponent, // floor division
a=int (input ("enter a first no. "))
b=int (input ("enter a second no. "))
print (a+b)
print (a-b)
print (a/b)
print (a*b)
print (a/b)
print (a%b)
print (a**b)
print (a//b)
OUTPUT
enter a first no. 8
enter a second no. 7
15
1.1428571428571428
56
1.1428571428571428
2097152
1
PROGRAM 2
#Write a program of comparision /relational operators- >,<,==,>=,=<
a=int (input ("enter a first no. "))
b=int (input ("enter a second no. "))
if a>b:
print ("a is maximum. ")
else:
print ("b is maximum. ")
OUTPUT
enter a first no. 3
enter a second no. 4
b is maximum.
PROGRAM 3
Write a program of logical operators- and , or, not
a=int (input ("enter a first no. "))
b=int (input ("enter a second no. "))
c=int (input ("enter a thrid no. "))
if (a>b)or(a>c):
Print ( "a is maximum. ")
elif (b>a) and (b>c) :
Priat ("b is maximum. ")
print (" c is maximum. ")
OUTPUT
enter a first no. 4
enter a second no. 5
enter a thrid no. 6
c is maximum
PROGRAM 4
#Write a program of Assignment operators - =,+=,-=,*=,/=,**=,//=
a=int(input("enter a first number. "))
b=int(input("enter a second number. "))
b+=a
print(b)
OUTPUT
enter a first number. 43
enter a second number. 56
99
PROGRAM 5
#Write a program of Identity operators - is, is not
a=eval (input("enter a number. "))
if(type(a) is int):
print(" a is integer. ")
else:
print("a is not integer. ")
OUTPUT
enter a number. 454
a is integer.
PROGRAM 6
#Write a program of Membership Operators - in , not in
a=input("enter a number.")
list=["Hello" ,10,"abc",20,30,40,10.6,50]
if (a in list):
print("a are present in in the list ")
else:
print("a is not present in this list")
OUTPUT
enter a number.44
a is not present in this list
PROGRAM 7
#Write a program of Bitwise Operators- & and , or ,XOR
a=int(input("enter a first number."))
b=int(input("enter a second number."))
print(bin(a))
print(bin(b))
print(bin(a&b),a&b)
OUTPUT
enter a first number.54
enter a second number.56
0b110110
0b111000
0b110000 48
PROGRAM 8
#Write a program to find even or odd number
a=int(input("enteer a number"))
if(a%2==0):
print("even number")
else:
print("odd number")
OUTPUT
enter a number67
odd number
PROGRAM 9
'''#Write a program to class for voting eligible
a=int(input("enter the age"))
if (a>18):
print("eligible for voting")
else:
print("not eligible for voting")
OUTPUT
enter the age13
not eligible for voting
PROGRAM 10
#Write a program to find maximum number between two number
a=int(input("enter first number"))
b=int(input("enter second number"))
if(a>b):
print("a is maximum")
else:
print("b is maximum")
OUTPUT
enter first number45
enter second number56
b is maximum
PROGRAM 11
#Write a program to find maximum number between three number
a=int(input("enter first number"))
b=int(input("enter second number"))
c=int(input("enter third number"))
if((a>b) and (a>c)):
print("a is maximum")
elif((b>a) and (b>c)):
print("b is maximum")
else:
print("c is maximum")
OUTPUT
enter first number54
enter second number34
enter third number56
c is maximum
PROGRAM 12
#Write a program to check the is +ve,-ve,0
a=int(input("enter the number"))
if(a>0):
print("a is +ve")
elif(a<0):
print("a is -ve")
else:
print("a is zero")
OUTPUT
enter the number56
a is +ve
PROGRAM 13
#Write a program to find the middle of 3 number of group
a=int(input("enter the first number"))
b=int(input("enter the second number"))
c=int(input("enter the third number"))
if((a>b) and(a<c) or (a<b) and (a>c)):
print("a is middle number")
elif((b>a) and (b<c) or (b<a) and(b>c)):
print("b is middle number")
else:
print("c is middle number")
OUTPUT
enter the first number56
enter the second number78
enter the third number89
b is middle number
PROGRAM 14
#Write a program to caluclate the percentage
maths= int(input("enter the marks of maths"))
english=int(input("enter the marks of english"))
hindi=int(input("enter the marks of hindi"))
science=int(input("enter the marks of science"))
sst=int(input("enter the marks of sst"))
Total=int(input("enter the marks of Total"))
percentage=(((maths+english+hindi+science+sst)/Total)*100)
print(percentage)
if (percentage>=90):
print("grade A")
elif(percentage >=80):
print("grade B")
elif(percentage >=70):
print("grade C")
elif(percentage>=60):
print("grade D")
elif(percentage>=50):
print("grade E")
elif(percentage >=40):
print("grade F")
else:
print("Fail")
OUTPUT
enter the marks of maths78
enter the marks of english89
enter the marks of hindi98
enter the marks of science87
enter the marks of sst78
enter the marks of Total500
86.0
grade B
PROGRAM 15
#write a program in python to accept total sale amount and find the profit @5%
total_sale=int(input("enter a total sale amount"))
profit=total_sale*5/100
print("profit amount",profit)
OUTPUT
enter a total sale amount79
profit amount 3.95
PROGRAM 16
#WAP in python input sales amount & calculate based on the given discount rate in python
amount discount
0-5000 5%
5000-10000 12%
10,000-20,000 20%
20,000-25,000 30%
amt=int(input("enter the sale amount"))
if(amt>0 and amt<5000):
discount=amt*5/100
print("discount amount",discount)
print("payable amount",amt-discount)
elif(amt>=5000 and amt<10000):
discount=amt*12/100
print("discount amount",discount)
print("payable amount",amt-discount)
elif(amt>=10000 and amt<20000):
discount=amt*12/100
print("discount amount",discount)
print("payable amount",amt-discount)
elif(amt>=20000 and amt<25000):
discount=amt*30/100
print("discount amount",discount)
print("payable amount",amt-discount)
OUTPUT
enter the sale amount7000
discount amount 840.0
payable amount 6160.0
PROGRAM 17
#Write a program to swap values of two number
a=int(input("enter a first number"))
b=int(input("enter a second number"))
print("before swapping",a)
print("before swapping",b)
temp=a
a=b
b=temp
print("after swapping ",a)
print("after swapping",b)
OUTPUT
enter a first number67
enter a second number89
before swapping 67
before swapping 89
after swapping 89
after swapping 67
PROGRAM 18
#write a program in python find the area of rectangle
length=float(input("enter the length"))
breadth=float(input("enter the breadth"))
print(length*breadth)
OUTPUT
enter the length4
enter the breadth6
24.0
PROGRAM 19
#write a program in python find the area of circle
radius=int(input("enter the radiu"))
pi=3.14
print(pi*radius*radius)
OUTPUT
enter the radiu6
113.03999999999999
PROGRAM 20
#write a program in python find the area of square
side=int(input("enter the side"))
print(side*side)
OUTPUT
enter the side7
49
PROGRAM 21
#write a program in python find the perimeter of rectangle
length=float(input("enter the length"))
breadth=float(input("enter the breadth"))
print(2*(length+breadth))
OUTPUT
enter the length34
enter the breadth43
154.0
PROGRAM 22
#write a program in python find the perimeter of circle
radius=int(input("enter the radius"))
pi=3.14
print(2*pi*radius)
OUTPUT
enter the radius34
213.52
PROGRAM 23
#write a program in python find the perimeter of square
side=int(input("enter the side"))
print(4*side)
OUTPUT
enter the side67
268