Number combinations

placid Bulkan at gmail.com
Wed Jul 19 10:01:24 EDT 2006


Hi all,

Just wondering if there is a better way of generating a 4 digit number
(that gets converted to a string), ive got the following code which
generates strings between 0000-9999.

<code>

for a in range(0,10):
    for b in range(0,10):
        for c in range(0,10):
            for d in range(0,10):
                print "%s%s%s%s" %(str(a), str(b), str(c),str(d)

</code>


--Cheers

http://bulkan.googlepages.com/python




More information about the Python-list mailing list