Why a number like 01
gives a Syntax error when 01
is typed in python interactive mode and pressed enter?
When 00
is entered the interpreter evaluates to 0
, however numbers like 01
, 001
or anything which starts with a 0
is entered Syntax error:invalid token is displayed.
Entering 1,000
in prompt evaluates to a tuple of (1,0)
but 1,001
doesn't evaluate to (1,1)
instead Syntax error is displayed.
Why does the Python interpreter behave so?