Oct-09-2017, 07:32 PM
Hi,
Started using Nested Ifs in my work and have made this code.
math=int(input("Enter your math score: \n"))
english=int(input("Enter your english score: \n"))
science=int(input("Enter your science score: \n"))
average=math+english+science/3
if average>50:
print("You have a score of at least 50.")
if 50<= average <= 64:
print("You have passed with a grade C.")
elif 65<= average <= 75:
print("You have passed with a grade B.")
elif 75<= average <= 90:
print("You have passed with a grade A.")
elif 90> average <= 100:
print("You have passed with a grade A*.")
else:
print("Better luck next time.")
For some reason, no matter what score I put into the variables, it just says "You have a score of at least 50." but never mentions a grade letter.
Would appreciate any help in solving this. :)
Started using Nested Ifs in my work and have made this code.
math=int(input("Enter your math score: \n"))
english=int(input("Enter your english score: \n"))
science=int(input("Enter your science score: \n"))
average=math+english+science/3
if average>50:
print("You have a score of at least 50.")
if 50<= average <= 64:
print("You have passed with a grade C.")
elif 65<= average <= 75:
print("You have passed with a grade B.")
elif 75<= average <= 90:
print("You have passed with a grade A.")
elif 90> average <= 100:
print("You have passed with a grade A*.")
else:
print("Better luck next time.")
For some reason, no matter what score I put into the variables, it just says "You have a score of at least 50." but never mentions a grade letter.
Would appreciate any help in solving this. :)