-2

What can be the smallest possible code in any language(I guess Python will win) to print "001002003004005006007008009010011012013014015016017018019020021022023024025"

Basically it is counting from 1 to 25.

3 Answers3

2

Try this

print("".join(map(lambda x:str(x).zfill(3),range(1,26))))

or

print(reduce(lambda x,y:x+str(y).zfill(3),range(1,26),""))
ignite234
  • 21
  • 3
0

You could use one of these methods to pad the numbers with zero's after converting them to strings. Then simply join the strings together and print or print each string. But the first one should get the job done.

for i in range(1,26):
    print(str(n).zfill(3), end="")
Community
  • 1
  • 1
avlec
  • 396
  • 1
  • 15
0

Try this in python3

    [print("%03d"%i,end='') for i in range(1,26)]
Ankit
  • 130
  • 3
  • 13