0
is there any way to use integer value with leading 0 Python?
0b is for binary 0o for octal but what to do for leading 0 in integer values in Python https://code.sololearn.com/cfQe6Ub4ddJV/?ref=app
4 Answers
+ 4
The method input() always returns a string.
In your prog the variable userinput is not a string.
That might be confusing you
+ 3
User enters 01234 and u want to go on with 1234 right?
+ 3
print ('{:010d}'.format(12345))
+ 1
you can use string.
and use int() when you need it as an int. since int() will convert to base 10 by default you dont have to worry for it to be octal
https://code.sololearn.com/cxd5QuYsp5mP/?ref=app