r/learnpython•
goochcrust

Can't figure this out

Keep getting this

>>> a = int(input("Pick a year from 1900 to 2100: "))
Pick a year from 1900 to 2100: while ((a < 1900) or (a > 2100)):
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'while ((a < 1900) or (a > 2100)):'
>>>     a = int(input("Pick a year from 1900 to 2100: "))

When I copy and paste this to terminal.

a = int(input("Pick a year from 1900 to 2100: "))
while ((a < 1900) or (a > 2100)):
    a = int(input("Pick a year from 1900 to 2100: "))

Posted Sep 16, 2015, 6:05 AM UTC

14
Loading comments…