1

I want to go through each number in the range 1-1000, but I need my program to be 3 digits. So 001, 002, 003,...,999. How can I do this?

juanpa.arrivillaga
  • 88,713
  • 10
  • 131
  • 172

1 Answers1

0

You can format it to a string with leading zeroes:

for i in range(0, 1000):
    print "%03d" % (i)
Mureinik
  • 297,002
  • 52
  • 306
  • 350