<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> </DIV>
<DIV><FONT face=Arial size=2>Kevin</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>print """<BR>0 Exit<BR>1 Add<BR>2 Subtract</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>"""<BR>number = raw_input("Enter a number: ")</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>while 1:<BR> try:<BR> number = int(number)<BR> break<BR> except ValueError:<BR> print "That is not an option"<BR> number = raw_input("Enter a number: ")<BR>if int(number) == 1:<BR> import add<BR>if int(number) == 2:<BR> import subtract</FONT></DIV></BLOCKQUOTE></DIV>
<DIV>just put the entire thing within a while loop and put a break or change the condition (from True to False) if they select exit, like so:</DIV>
<DIV> </DIV>
<DIV><STRONG>a = True</STRONG></DIV>
<DIV><STRONG>while a:</STRONG></DIV>
<DIV>
<DIV><FONT face=Arial size=2> print """<BR>0 Exit<BR>1 Add<BR>2 Subtract</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>"""<BR> number = raw_input("Enter a number: ")</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> while 1:<BR> try:<BR> number = int(number)<BR> break<BR> except ValueError:<BR> print "That is not an option"<BR> number = raw_input("Enter a number: ")<BR><STRONG> if int(number) == 0:</STRONG></FONT></DIV>
<DIV><STRONG> a = False</STRONG></DIV>
<DIV><FONT face=Arial size=2> if int(number) == 1:<BR> import add<BR> if int(number) == 2:<BR> 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 number prompt like so:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>number = 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>... """)</DIV></FONT></DIV></DIV>
<DIV> </DIV>
<DIV>using the above code, you'd have to change the program so that it read:</DIV>
<DIV> </DIV>
<DIV>
<DIV>a = True</DIV>
<DIV>while a:</DIV>
<DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2> number = 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>... """)</FONT></DIV></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> while 1:<BR> try:<BR> number = int(number)<BR> break<BR> except ValueError:<BR> print "That is not an option"<BR> number = raw_input("Enter a number: ")</FONT></DIV>
<DIV><FONT face=Arial size=2> if int(number) == 1:<BR> import add<BR> if int(number) == 2:<BR> import subtract</FONT></DIV></DIV></DIV>
<DIV> if int(number) == 3:
<DIV> a = False</DIV></DIV>
<DIV> </DIV>
<DIV>HTH,</DIV>
<DIV>Orri</DIV>
<DIV> </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>