<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body><div style="text-align: left;">Thanks Andre.&nbsp; That solved most of the problems.&nbsp; Now all the lists will run correctly, but when I input a radius, it says:<br><br>can't multiply sequence by non-int of type 'float'<br></div><br>When it displays that, it is talking about circumference=(radius*2*3.14).&nbsp; I'm guessing it doesn't want me to multiply by pi.&nbsp; PLEASE HELP!!!<br>thanks in advance,<br>Adam<br><br><br><hr id="stopSpelling">&gt; Date: Wed, 23 May 2007 18:08:20 +0200<br>&gt; From: andreengels@gmail.com<br>&gt; To: adamurbas@hotmail.com<br>&gt; Subject: Re: [Tutor] trouble with "if"<br>&gt; CC: tutor@python.org<br>&gt; <br>&gt; The problem is with types. The outcome of raw_input is a string. But<br>&gt; if you give the line:<br>&gt; <br>&gt; if shape == 1:<br>&gt; <br>&gt; you are comparing it with a number. The text "1" is not equal to the<br>&gt; number 1, so this evaluates to False.<br>&gt; <br>&gt; Instead you should do:<br>&gt; <br>&gt; if shape == "1":<br>&gt; <br>&gt; To also be able to type 'circle' instead of '1', you can do:<br>&gt; <br>&gt; if shape == "1" or shape == "circle":<br>&gt; <br>&gt; or alternatively:<br>&gt; <br>&gt; if shape in ["1","circle"]:<br>&gt; <br>&gt; <br>&gt; <br>&gt; Andre Engels<br>&gt; <br>&gt; 2007/5/23, adam urbas &lt;adamurbas@hotmail.com&gt;:<br>&gt; &gt;<br>&gt; &gt; Hi all,<br>&gt; &gt;<br>&gt; &gt; I've been working with this new program that I wrote.  I started out with it<br>&gt; &gt; on a Ti-83, which is much easier to program than python.  Now I'm trying to<br>&gt; &gt; transfer the program to python but its proving to be quite difficult.  I'm<br>&gt; &gt; not sure what the whole indentation thing is for.  And now I'm having<br>&gt; &gt; trouble with the if statement things.<br>&gt; &gt;<br>&gt; &gt; #"Circle Data Calculation Program:"<br>&gt; &gt; print "Welcome to the Circle Data Calcuation Program."<br>&gt; &gt; print<br>&gt; &gt;<br>&gt; &gt;     #"Menu 1:"<br>&gt; &gt; print "Pick a shape:"<br>&gt; &gt; print "(NOTE: You must select the number of the shape and not the shape<br>&gt; &gt; itself)"<br>&gt; &gt; print "1 Circle"<br>&gt; &gt; print "2 Square"<br>&gt; &gt; print "3 Triangle"<br>&gt; &gt;<br>&gt; &gt;     #"User's Choice:"<br>&gt; &gt; shape=raw_input("&gt; ")<br>&gt; &gt;<br>&gt; &gt;         #"Select Given:"<br>&gt; &gt; if shape == 1:<br>&gt; &gt;         print "Choose the given value:"<br>&gt; &gt;         print "1 radius"<br>&gt; &gt;         print "2 diameter"<br>&gt; &gt;         print "3 circumference"<br>&gt; &gt;         print "4 area"<br>&gt; &gt;<br>&gt; &gt; #"User's Choice:"<br>&gt; &gt; given=raw_input("&gt; ")<br>&gt; &gt;<br>&gt; &gt; if given == 1:<br>&gt; &gt;         radius=raw_input("Enter Radius:")<br>&gt; &gt;         diameter=(radius*2)<br>&gt; &gt;         circumference=(diameter*3.14)<br>&gt; &gt;         area=(radius**2*3.14)<br>&gt; &gt;         print "Diameter:", diameter<br>&gt; &gt;         print "Circumference:", circumference<br>&gt; &gt;         print "Area:", area<br>&gt; &gt;<br>&gt; &gt; if given == 2:<br>&gt; &gt;         diameter=raw_input("Enter Diameter:")<br>&gt; &gt;         radius=(diameter/2)<br>&gt; &gt;         circumference=(diameter*3.14)<br>&gt; &gt;         area=(radius**2*3.14)<br>&gt; &gt;         print "Radius:", radius<br>&gt; &gt;         print "Circumference:", circumference<br>&gt; &gt;         print "Area:", area<br>&gt; &gt;<br>&gt; &gt; if given == 3:<br>&gt; &gt;         circumference=raw_input("Enter Circumference:")<br>&gt; &gt;         radius=(circumference/3.14/2)<br>&gt; &gt;         diameter=(radius*2)<br>&gt; &gt;         area=(radius**2*3.14)<br>&gt; &gt;         print "Radius:", radius<br>&gt; &gt;         print "Diameter:", diameter<br>&gt; &gt;         print "Area:", area<br>&gt; &gt;<br>&gt; &gt; if given == 4:<br>&gt; &gt;         area=raw_input("Enter Area:")<br>&gt; &gt;         radius=(area/3.14)<br>&gt; &gt;<br>&gt; &gt; This is the whole program so far, because I haven't quite finished it yet.<br>&gt; &gt; But I tried to get it to display another list of options after you select a<br>&gt; &gt; shape but it just does this.<br>&gt; &gt;<br>&gt; &gt; Pick a shape:<br>&gt; &gt; 1 Circle<br>&gt; &gt; 2 Square<br>&gt; &gt; 3 Triangle<br>&gt; &gt; &gt;1<br>&gt; &gt; &gt;1<br>&gt; &gt; &gt;&gt;&gt;<br>&gt; &gt;<br>&gt; &gt; I'm not sure why it does that but I do know that it is skipping the second<br>&gt; &gt; list of options.<br>&gt; &gt;<br>&gt; &gt; Another of my problems is that I can't figure out how to get it to accept<br>&gt; &gt; two different inputs for a selection.  Like I want it to accept both the<br>&gt; &gt; number 1 and circle as circle then list the options for circle.  It won't<br>&gt; &gt; even accept words.  I can only get it to accept numbers.  It's quite<br>&gt; &gt; frustrating actually.<br>&gt; &gt;<br>&gt; &gt; Any advice would be greatly appreciated.<br>&gt; &gt; Thanks in advance,<br>&gt; &gt; Adam<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; I tried to get it to display ano<br>&gt; &gt;<br>&gt; &gt; ________________________________<br>&gt; &gt; Add some color. Personalize your inbox with your favorite colors. Try it!<br>&gt; &gt; _______________________________________________<br>&gt; &gt; Tutor maillist  -  Tutor@python.org<br>&gt; &gt; http://mail.python.org/mailman/listinfo/tutor<br>&gt; &gt;<br>&gt; &gt;<br>&gt; <br>&gt; <br>&gt; -- <br>&gt; Andre Engels, andreengels@gmail.com<br>&gt; ICQ: 6260644  --  Skype: a_engels<br><br /><hr />Change is good. See what's different about Windows Live Hotmail. <a href='www.windowslive-hotmail.com/learnmore/default.html?locale=en-us&ocid=RMT_TAGLM_HMWL_reten_changegood_0507' target='_new'>Check it out!</a></body>
</html>