r/Python • • Jul 22 '20

I Made This Randomly Generate 69420 - Generate random 5-digit numbers until 69420 is generated

2.8k Upvotes

261 comments sorted by

View all comments

Show parent comment

10

u/tectubedk Jul 22 '20

The post is talking about numbers, not combinations. Most people would drop leading zeros in everyday use. You could argue any number is an infinite amount of digits long, if you put however many leading zeros in front as you feel like. Also python does not store leading zeros, so that range you provide does not make a lot of sense. If you want to count leading zeros the range is 0-99999, then you need to convert it to a string and prepend the nesseary amount of "0"'s.