Counting in Python Using a List

So before we begin, let me just tell you that this is a pretty useless thing to do.. But I was playing around with it while waiting for a C++ project to finish compiling, so why not!

The code (click here for the Gist):

magic = 0x616f-0x414f

numbers = [

i = c = numbers[0]

while True:
    print('%d%d' % (c, round(numbers[int(i)])))
    i += 1
    if i>len(numbers)-1:
        i = 0
        c += 1

If you ran it, it would look like this!

The numbers list in the code above is just an obfuscated way of writing 0..9.

The only real logic in this is the body of the while loop which prepends a zero each time it hits the end of the range.

This demonstrates the ability to count and not rely on the decimal system for example.