Python Forum
What am i doing wrong - math tool box
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What am i doing wrong - math tool box
#7
(Apr-18-2018, 07:45 PM)TJOm Wrote: What would you like to do?1
'1'


Boom, there's your answer. See the quotes? ans is a string. You're comparing it against ints, which will never be true. So, either...

a) change your if statements to compare against a string: if ans == "1":, or
b) force ans to be an int: ans = int(ans).
Reply


Messages In This Thread
What am i doing wrong - math tool box - by TJOm - Apr-18-2018, 06:59 PM
RE: What am i doing wrong - math tool box - by TJOm - Apr-18-2018, 07:37 PM
RE: What am i doing wrong - math tool box - by TJOm - Apr-18-2018, 07:45 PM
RE: What am i doing wrong - math tool box - by nilamo - Apr-18-2018, 07:54 PM
RE: What am i doing wrong - math tool box - by TJOm - Apr-18-2018, 08:06 PM

Forum Jump:

User Panel Messages

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