Python Forum
My first go at Python hasn't gone well
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My first go at Python hasn't gone well
#4
The input function returns a string, so the response variable is a string value. You then compare it to the integer value of correct. They will never be equal. You want to convert the string to an integer with int:

response = int(input('response? '))
Note you can do:

print('What is', number, 'X', table)
to print it all on one line. You might also want to look into the format method of strings.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: My first go at Python hasn't gone well - by ichabod801 - Dec-01-2016, 11:18 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020