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




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS