[Tutor] "Goto"-function

Thomas Ueland Torp ttorp@netpower.no
Wed, 14 Mar 2001 19:51:56 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_000C_01C0ACC0.39C453C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am new to Python. In fact I am new to all of programming, having only =
done a tiny bit on my calculator (a Texas Instruments). What I wanted to =
know was that if I have a programming code, and want to go to a certain =
point in the code, from another point, how do I do that (what is the =
code for it)?
Example:
print 'Main Menu'
print '1. something'
print '2. something else'
print '3...'

a =3D int(raw_input("choose "))
if a =3D=3D 1:
    (some function, doesn't matter what in my question)
    print '1. back to main menu'
    print '2. Quit'

    b =3D int(raw_input("choose "))

    if b =3D=3D 1:
    ???

Oh, and how do I clear the screen on the python interpreter (with a code =
built-in in the program).

Sincerly
Thomas Torp

------=_NextPart_000_000C_01C0ACC0.39C453C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am new to Python. In fact I am new to =
all of=20
programming, having only done a tiny bit on my calculator (a Texas =
Instruments).=20
What I wanted to know was that if I have a programming code, and want to =
go to a=20
certain point in the code, from another point, how do I do that (what is =
the=20
code for it)?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Example:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print 'Main Menu'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print '1. something'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print '2. something else'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print '3...'</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>a =3D int(raw_input("choose =
"))</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if a =3D=3D 1:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; (some function, =
doesn't matter=20
what in my question)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; print '1. back to =
main=20
menu'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; print '2. =
Quit'</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; b&nbsp;=3D =
int(raw_input("choose=20
"))</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; if&nbsp;b =3D=3D =
1:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; ???</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Oh, and how do I clear the screen on =
the python=20
interpreter (with a code built-in in the program).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Sincerly</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thomas Torp</FONT></DIV></BODY></HTML>

------=_NextPart_000_000C_01C0ACC0.39C453C0--