Tuesday, March 16, 2010

Python Exercise 1


"Display series of numbers (1,2,3,4, 5....etc) in an infinite loop. The program should quit if someone hits a specific key (Say ESCAPE key)."

This exercise, for me, was a royal pain in the neck, and I ended up scouring the web for a solution. I finally found something I could modify to make work. From my understanding, it basically runs the loop in my answer until it detects something in the terminal buffer, at which point it breaks. I have it set so that anything will stop it from running, but you should be able to modify it to only respond to a certain keystroke.


Click to see Solution:

No comments: