Kute F.
asked 04/14/20using a leading zero (0) in Python 3.8
Why do you get the error below in Python ver 3.8
print(01)
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
1 Expert Answer

Marcus M. answered 04/14/20
Python Developer/Tutor Specializing In Python Basics/Fundamentals
The reason for this is because a non-zero decimal integer literal(21,5,15, etc) can't start of with a zero(021,05,015). But yet we can write print(00000) and get back 0. This violated a Python rule that said a syntax error would be raised if 0 is the starting number, followed by another number(including zero). So they changed it to where we can use int("0")+1 or whatever number and get back 1 or that number in return. But as for why we couldn't just start with 0 followed by whatever numbers is a complete mystery.
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Xtian Q.
Try: print(1) or: print(0.1)07/29/20