I want to start a
for loop from a number that has n-digits. For example:
n=2, then I should start the loop from 10
n=4, then I should start the loop from 1000
and so on…
That’s my code:
number == 0 while 1: number += 1 if len(str(number)) == n: for i in range(len(str(number))-1): #Do something
That works perfectly. But it takes too much time to reach the number of 5-, 6-, 7- or 8-digits. Have you any suggestions concerning the improvement of this code?