views:

57

answers:

3
random.randint(50,9)

or

random.randint(5,09)

give errors, although just

random.randint(5,9)

..works!

Leading and trailing zero's aren't allowed in python without converting it to string or using x.f formatting?

A: 

A leading 0 means that the value is an octal literal, but 09 is not a valid octal number.

Ignacio Vazquez-Abrams
+5  A: 

oh, dear. "Trailing" zero gives error because first argument to randint should be smaller than the second.

Leading zeros are used to represent octal numbers in python-2.x as in many other languages.

SilentGhost
Ermm, thanks! :)
Nimbuz
+1 for being polite on the "tailing zero" business. I'm totally baffled by what "trailing zero" could even mean other than 10x.
S.Lott
A: 

09 is not a valid dec integer in the second case and in the first case - you have to give the function the lower number first

DreamWave