Python Forum

Full Version: help! if statement not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
so i need to write a code that will do the following
#ask for name
#ask for health score
#ask for grade
#ask for economic output
#if the grade is A OR economic output is above 85 print they meet the criteria
#if the health score and economic output are both over 60 and grade is at least a C print congratulations
#otherwise print sorry

I have written the below but it doesnt work. It doesnt print the correct statements at the end.
can someone show me where i am going wrong please.



name = raw_input("Enter your name:")

health = raw_input("Enter your standardised health score:")

grade = raw_input("Enter your standardised grade:")

economic = raw_input("Enter your standardised economic output score:")

if grade == "A" or economic >85:
print name, "you meet the exceptional criteria."
elif health and economic >60 and grade >= "C":
print "Congratualtions", name, "you have been selected."
else:
print "Sorry", name, "you are not permitted to board the ship."
Please put your code in Python code tags, you can find help here.

Can you provide an example case(s) of what was your input, and actual vs. desired output?
Some testing is in order when it doesn't work. This is enough to reveal the first mistake in your code. And I would suggest that you go through a tutorial as it wastes everyone's time to ask a question that is answered in most every tutorial https://wiki.python.org/moin/BeginnersGuide/Programmers
name = raw_input("Enter your name:")

health = raw_input("Enter your standardised health score:")

grade = raw_input("Enter your standardised grade:")

economic = raw_input("Enter your standardised economic output score:")

if grade == "A":
    print "grade ==A OK":
if economic >85:
    print "economic > 85"