Forum Thread: I Can't Solve an Error in Python Code

So i was going to try make some virtual discussion with ice skate seller to see my python knowledge.. All I can say is that i have been learning it for a week but i did not have time to really get in to it. Anyhow... here is the code so if you can help me find out why do I have a error. Actually it is not an error, it doesn't say it is an error it just doesn't run the if command, try it yourself to see what I am talking about.

print("Hello, welcome to the skate arena!")
question_1 = "skatenum"
yes = True
no = False
skatenum = input("Whould you like to purchase skates? (yes/no) --> ")
if skatenum == True:
x = "skates"
skates = int(input("How much of them would you like? One pair is $2.99 (1, 2, 3)"))
if skates == 1:
print("Ok, that is $3")
elif skates == 2:
print("Ok, that is $6")
elif skates == 3:
print("Ok, that is $9")
elif skates > 3:
print("Sorry, we do not give out that number of pairs")
print("Please get out of Arena.")
elif skatenum == False:
print("Ok, then please sit down on tribune")

This is an output. It should load the if statements but it doesn't... Please help

Join the Next Reality AR Community

Get the latest in AR — delivered straight to your inbox.

2 Responses

Your code is not working because you are defining yes as a boolean, but input gives you a string, so yes doesn't equals 'yes'. This is the working code:

Ahh, yes, I see. Thank you very much for help.

Share Your Thoughts

  • Hot
  • Active