You put program code in a loop and designate one key to break out of loop:
# this is an example of your program:
print "My program! Really!"
choice = raw_input("Enter r (repeat) or q (quit): ")
if 'q' in choice:
break # exits the while loop, any other key repeats loop
Here is another example how to do this, as suggested by cscgal ...
# save this code as endless.py
password = raw_input("I am running almost endlessly unless you enter the secret password: ")
if 'q' in password:
raise SystemExit, "I am quitting now ..."
Notice how the ultimate escape has been accomplished.
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...