Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 help! if statement not working
#1
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."
Quote
#2
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?
Quote
#3
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"  
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Else Statement Not Working SenkouSimmer 4 275 Jul-22-2019, 11:42 AM
Last Post: jefsummers
  Simple IF statement not working as intended gortexxx 2 604 May-17-2018, 07:54 PM
Last Post: gortexxx

Forum Jump:


Users browsing this thread: 1 Guest(s)