ActiveState Code

Recipe 440636: The eight, most annoying lines of code I ever did write.


This program counts in a very strange way. Be sure to review it so that you can figure out how to shut it down. If you don't, you will get just as annoyed as I did. :P

Python
1
2
3
4
5
6
7
8
old = '-1.py'
import os
os.remove(old)
data = 'old = \'' + str(int(old[:-3]) + 1) + '.py\'\n'
for line in file(str(int(old[:-3]) + 1) + '.py').readlines()[1:]:
    data += line
file(str(int(old[:-3]) + 2) + '.py', 'w').write(data)
os.startfile(str(int(old[:-3]) + 2) + '.py')

Discussion

If you just want to annoy someone, you could run this program on their computer. Just make sure that there is a file called -1.py is the same directory and that this program is called 0.py (that's it). You might also just let this program run for as long as you want and then find out how many times it ran (by looking at its filename). Now you have choices -- go have some fun or annoy yourself. :)

Sign in to comment