Professional Documents
Culture Documents
Practice Questions On Conditional Statements
Practice Questions On Conditional Statements
statements
1) To check whether you are eligible to vote or not
Your program should get the age of the voter from the user
and if their age is 18 and above, let them vote otherwise
deny them from voting.
print("\n---------Printing result-------------")
print("Name:", name)
print("Class:", clas)
print("Section:", section)
print("Percentage:", percentage,"%")
if percentage < 0 or percentage > 100:
print("Error: percentage should be between 0 and 100 only!")
elif percentage < 45:
print("Failed!")
elif percentage >= 45:
print("Error: percentage should be between 0 and 100 only!")
elif percentage < 45:
print("Failed!")
elif percentage >= 45:
print("Pass!")
if percentage >=45 and percentage < 60:
print("Remark: Just passed!")
elif percentage >= 60 and percentage < 75:
print("Remark: Good!")
elif percentage >= 75 and percentage < 85:
print("Remark: Very Good!")
elif percentage >= 85 and percentage < 100:
print("Remark: Excellent!")
5) Find the given number is positive or negative number.
6)Find the given number is divisible by 5 or not
7) If the triangle is an acute angle triangle, determine
further whether the triangle is equilateral, isosceles, or
scalene.
Code:7
print("Input lengths of the triangle sides: ")
x = int(input("x: "))
y = int(input("y: "))
z = int(input("z: "))
if x == y == z:
print("Equilateral triangle")
elif x==y or y==z or z==x:
print("isosceles triangle")
else:
print("Scalene triangle")