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
  • 77,035
  • 9
  • 115
  • 152

1 Answers1

0

You can format it to a string with leading zeroes:

for i in range(0, 1000):
    print "%03d" % (i)
Mureinik
  • 277,661
  • 50
  • 283
  • 320