I'm work on a problem which I set myself for fun, which is to create a python script which prints the even numbers from 0 to 100. The challenge is to make the script as small as possible. This is what I have so far:
for x in range(0, 101):
if (x % 2 == 0):
print x
Currently it is 60 bytes. Can anyone think of a way to make it smaller?
Edit: print(*range(2,101,2),sep='\n')
which is 30 bytes. Any smaller?
i=2;exec"print i;i+=2;"*50
– bitpwner 13 hours agoprint "0 10 100"
(is binary OK?) – squeamish ossifrage 8 hours ago