Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simple calculator
#6
Larz60+ ran that code in Python 3.x, that's why he got that error. You're running that code in Python 2.x, that's why you're getting your error. In Python 2.x, input evaluates the user's input before returning it, so it is returning an integer to choice. That does not equal either of the strings you are testing against. Either use raw_input, or test against integer values.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
simple calculator - by shakeelthomas - Jul-22-2018, 10:24 PM
RE: simple calculator - by Larz60+ - Jul-22-2018, 11:18 PM
RE: simple calculator - by shakeelthomas - Jul-22-2018, 11:28 PM
RE: simple calculator - by Larz60+ - Jul-22-2018, 11:35 PM
RE: simple calculator - by shakeelthomas - Jul-22-2018, 11:44 PM
RE: simple calculator - by ichabod801 - Jul-23-2018, 12:37 AM
RE: simple calculator - by shakeelthomas - Jul-23-2018, 01:13 AM
RE: simple calculator - by ichabod801 - Jul-23-2018, 03:17 AM
RE: simple calculator - by shakeelthomas - Jul-23-2018, 03:45 AM
RE: simple calculator - by Larz60+ - Jul-23-2018, 03:53 AM
RE: simple calculator - by buran - Jul-23-2018, 04:17 AM
RE: simple calculator - by shakeelthomas - Jul-23-2018, 10:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple calculator ryza 3 1,189 Sep-21-2022, 04:42 PM
Last Post: deanhystad
  Simple Distance Between Points Calculator Spade 1 1,781 Sep-17-2021, 03:14 PM
Last Post: DeaD_EyE
  Printing simple calculator answer LCFC2020 2 2,223 Dec-05-2020, 02:07 PM
Last Post: MK_CodingSpace

Forum Jump:

User Panel Messages

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