Question #232995

In math notation, leading zeros are OK, as in 02. What happens if you try this in Python and why


Expert's answer

if you try to use leading zeros including, you will get an error like this:

File "<string>", line 3

print(001)

^

SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers


because python doesn't support leading zeros in numbers




LATEST TUTORIALS
APPROVED BY CLIENTS