View Single Post
  #2 (permalink)  
Old 06-10-2007, 05:22 PM
Paul P
Posts: n/a
First question:

You can use raw_input() to "pause" and keep the window open. This function prints its argument to the screen and waits for user input. For example, if I wanted to keep a dos prompt open, I might have as my last line of the program:

raw_input('Press <enter> to continue")

Second question:

breaking out of your outer loop is simple. just set a flag in your inner loop, and if the flag is true, break out of your outer loop. for example,

fBreak = False
for x in range(10):
....for y in range(10):
........sum = x + y
........if sum > 15:
............fBreak = True
............break
....if fBreak:
........break

Notes:
i use dots to represent spaces since this forum strips spaces from your text and i have not discovered a way to prevent that from occurring.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!