You are on page 1of 1

computer python

programing

1. #write a program to read a number a and b and find the greatest of the two
numbers
80 is greater than60
A=input("Enter your first number")
B=input("Enter your second number")
if(A>B):
print("{0} is greater than{1}".fprmat(A,B))
else:
print("{0} is greater than{1}".format(B,A))

2.#Write a program to read three numbers and find their average


A=int(input("Enter the first number"))
B=int(input("Enter the second number"))
C=int(input("Enter the third number"))
Total= A + B+ C
Average= Total/3
print("average of{0},{1},{2}is{3}".format(A,B,C Average))

3.#write a program to read the age of a person and check whether he is eligible to
vote (hint : If age more than 18 he is allowed to vote)
Age=int(input("Enter your age"))
if(Age>18):
print("you are eligible to vote")
else:
print("you are not eligible to vote")

4.# A dice is thrown, and the outcome can be either 1,2,3,4,5 or 6. Write a program
to read the outcome and if it is 1, 5 or 6 then allow the person to throw the dice
one more time

outcome=int(input("Enter outcome of the dice"))


if(outcome==1) or (outcome==5) or (0utcome==6):
print("you can throw the dice one more time")
else:
print("pass the dice to the next person")

You might also like