like many languages, an integer with a leading zero is interpreted as an octal. this means that it's base eight. for example, 020 has decimal value 16 and 030 has decimal value 24.
for the sake of completeness, this is how it works. value
takes a string and returns the decimal value of that string interpreted as an octal. It doesn't do any error checking so you have to make sure that each digit is between 0 and 8. no leading 0 is necessary.
def value(s):
digits = [int(c) for c in s]
digits.reverse()
return sum(d * 8**k for k, d in enumerate(digits))