Reputation: 13
score = int(0)
name = str(input("What is your name?"))
print("Hello " + name + "!")
pi = input( name + ", can you tell me the value of pi? ")
if score >= '6' :
print ("congratulations, " +name + " you passed the exam! You'll be richer than your wildest dreams!" )
else:
print: ("Listen, " +name + " you screwed up big time, with grades like this you'll be stuck working in a Best Buy for the rest of your life")
The problem is the if score statement, that's where I get the error. I need to have this "quiz" graded. I've been working on this all night, I'm not a good coder. Please help me
thank you in advance
Upvotes: 1
Views: 77
Reputation: 864
The int
in score = int(0)
isn't neccessary. You can just write score = 0
. For the comparison, do you really want to use the number 6 as a string? If not then just do this score >= 6
and it should work. I didn't test it but the code below should work.
score = 0
name = input("What is your name?")
print("Hello " + name + "!")
pi = input(name + ", can you tell me the value of pi?")
if score >= 6:
print("congratulations, " + name + " you passed the exam! You'll be richer than your wildest dreams!")
else:
print("Listen, " + name + " you screwed up big time, with grades like this you'll be stuck working in a Best Buy for the rest of your life")
Upvotes: 0
Reputation: 14389
You are comparing int
(score) with string
('6'). Try:
if score > 6: # <--omit the quotes
etc...
Upvotes: 1