It is necessary to make a cycle that will constantly add to the unit and print numbers to the console in the following form: 000 001 002 003 ... 011 012 013 ... 101 102, etc.

Closed due to the fact that the issue is too general for the participants Mikhail Vaysman , ermak0ff , Denis Bubnov , user194374, pavel Mar 1 '17 at 8:20 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

    3 answers 3

    Thus displays the numbers from 000 to 999 inclusive from the new line:

    for i in range(1000): print(str(i).zfill(3)) 

    Or a space:

     for i in range(1000): print(str(i).zfill(3), end=' ') 

    The str.zfill (3) function complements the str string up to 3 characters, filling the left with zeros.

      It can be much easier:

       for i in range(1000) print('{:03d}'.format(i)) # print('%03d' % i) 

        To print numbers on the same line with a pause:

         import time for i in range(1000): print('\r%03d' % i, end='', flush=True) time.sleep(1) 

        Related question: Text Progress Bar in the Console