<HTML><HEAD>
<META charset=US-ASCII http-equiv=Content-Type content="text/html; charset=US-ASCII">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: #ffffff">
<DIV>
<DIV>
<DIV>In a message dated 6/29/2004 1:48:01 AM Eastern Standard Time, game@gameweave.com writes:</DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: blue 2px solid">
<DIV><FONT face=Arial size=2>Well this is the little program that I have created it is my first one and it works just</FONT></DIV>
<DIV><FONT face=Arial size=2>fine from what I have tested. Only problem I have with it is that, lets say you enter</FONT></DIV>
<DIV><FONT face=Arial size=2>1 at the prompt it will load the add.py modual. however when it comes to the end</FONT></DIV>
<DIV><FONT face=Arial size=2>of the modual it terminats. How would I go about making it so that it will return to </FONT></DIV>
<DIV><FONT face=Arial size=2>the menu and ask for another choice.</FONT></DIV>
<DIV><FONT size=2></FONT><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Kevin</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>print """<BR>0 Exit<BR>1 Add<BR>2 Subtract</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>"""<BR>number = raw_input("Enter a number: ")</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>while 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number = int(number)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except ValueError:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "That is not an option"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number = raw_input("Enter a number: ")<BR>if int(number) == 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import add<BR>if int(number) == 2:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import subtract</FONT></DIV></BLOCKQUOTE></DIV>
<DIV>just put the entire thing within a while loop&nbsp;and put a break or change the condition (from True to False)&nbsp;if they select exit, like so:</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>a = True</STRONG></DIV>
<DIV><STRONG>while a:</STRONG></DIV>
<DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; print """<BR>0 Exit<BR>1 Add<BR>2 Subtract</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>"""<BR>&nbsp;&nbsp;&nbsp; number = raw_input("Enter a number: ")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; while 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; number = int(number)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; except ValueError:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; print "That is not an option"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; number = raw_input("Enter a number: ")<BR><STRONG>&nbsp;&nbsp;&nbsp; if int(number) == 0:</STRONG></FONT></DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a = False</STRONG></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; if int(number) == 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; import add<BR>&nbsp;&nbsp;&nbsp; if int(number) == 2:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; import subtract<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>by the way: you can just as easily make the menu be part of the&nbsp;number&nbsp;prompt like so:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>number =&nbsp;raw_input("""Enter a number:</FONT></DIV>
<DIV><FONT face=Arial size=2>1: Add</FONT></DIV>
<DIV><FONT face=Arial size=2>2: Subtract</FONT></DIV>
<DIV>3: Exit</DIV>
<DIV><FONT face=Arial size=2>...&nbsp;&nbsp;&nbsp; """)</DIV></FONT></DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>using the above code, you'd have to change the program so that it read:</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>a = True</DIV>
<DIV>while a:</DIV>
<DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; number =&nbsp;raw_input("""Enter a number:</FONT></DIV>
<DIV><FONT face=Arial size=2>1: Add</FONT></DIV>
<DIV><FONT face=Arial size=2>2: Subtract</FONT></DIV>
<DIV>3: Exit</DIV>
<DIV><FONT face=Arial size=2>...&nbsp;&nbsp;&nbsp; """)</FONT></DIV></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; while 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; number = int(number)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; except ValueError:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; print "That is not an option"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; number = raw_input("Enter a number: ")</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; if int(number) == 1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; import add<BR>&nbsp;&nbsp;&nbsp; if int(number) == 2:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; import subtract</FONT></DIV></DIV></DIV>
<DIV>&nbsp;&nbsp;&nbsp; if int(number) == 3: 
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; a = False</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>HTH,</DIV>
<DIV>Orri</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT lang=0 face=Arial size=2 FAMILY="SANSSERIF" PTSIZE="10">Email: dragonfirebane@aol.com<BR>AIM: singingxduck<BR>Programming Python for the fun of it.</FONT></DIV></BODY></HTML>