1

I have this line of code:

incoming = input("Type in 1 or 2")

if incoming == 1:
    print ("you entered 1")
elif incoming == 2:
    print ("you entered 2")

this worked perfectly fine when I used python 2... on my mac, but on windows with python 3, not so well.

Can anybody explain this to me?

The Dude
  • 1,088
  • 7
  • 16
  • 30

1 Answers1

3

Python 3.x doesn't evaluate and convert data types the way Python 2.x did. So, you are going to have to explicitly convert your user's input to an integer like this:

incoming = int(input("Type 1 or 2: "))
Jaxian
  • 1,146
  • 7
  • 14