<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. That solved most of the problems. 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). I'm guessing it doesn't want me to multiply by pi. PLEASE HELP!!!<br>thanks in advance,<br>Adam<br><br><br><hr id="stopSpelling">> Date: Wed, 23 May 2007 18:08:20 +0200<br>> From: andreengels@gmail.com<br>> To: adamurbas@hotmail.com<br>> Subject: Re: [Tutor] trouble with "if"<br>> CC: tutor@python.org<br>> <br>> The problem is with types. The outcome of raw_input is a string. But<br>> if you give the line:<br>> <br>> if shape == 1:<br>> <br>> you are comparing it with a number. The text "1" is not equal to the<br>> number 1, so this evaluates to False.<br>> <br>> Instead you should do:<br>> <br>> if shape == "1":<br>> <br>> To also be able to type 'circle' instead of '1', you can do:<br>> <br>> if shape == "1" or shape == "circle":<br>> <br>> or alternatively:<br>> <br>> if shape in ["1","circle"]:<br>> <br>> <br>> <br>> Andre Engels<br>> <br>> 2007/5/23, adam urbas <adamurbas@hotmail.com>:<br>> ><br>> > Hi all,<br>> ><br>> > I've been working with this new program that I wrote. I started out with it<br>> > on a Ti-83, which is much easier to program than python. Now I'm trying to<br>> > transfer the program to python but its proving to be quite difficult. I'm<br>> > not sure what the whole indentation thing is for. And now I'm having<br>> > trouble with the if statement things.<br>> ><br>> > #"Circle Data Calculation Program:"<br>> > print "Welcome to the Circle Data Calcuation Program."<br>> > print<br>> ><br>> > #"Menu 1:"<br>> > print "Pick a shape:"<br>> > print "(NOTE: You must select the number of the shape and not the shape<br>> > itself)"<br>> > print "1 Circle"<br>> > print "2 Square"<br>> > print "3 Triangle"<br>> ><br>> > #"User's Choice:"<br>> > shape=raw_input("> ")<br>> ><br>> > #"Select Given:"<br>> > if shape == 1:<br>> > print "Choose the given value:"<br>> > print "1 radius"<br>> > print "2 diameter"<br>> > print "3 circumference"<br>> > print "4 area"<br>> ><br>> > #"User's Choice:"<br>> > given=raw_input("> ")<br>> ><br>> > if given == 1:<br>> > radius=raw_input("Enter Radius:")<br>> > diameter=(radius*2)<br>> > circumference=(diameter*3.14)<br>> > area=(radius**2*3.14)<br>> > print "Diameter:", diameter<br>> > print "Circumference:", circumference<br>> > print "Area:", area<br>> ><br>> > if given == 2:<br>> > diameter=raw_input("Enter Diameter:")<br>> > radius=(diameter/2)<br>> > circumference=(diameter*3.14)<br>> > area=(radius**2*3.14)<br>> > print "Radius:", radius<br>> > print "Circumference:", circumference<br>> > print "Area:", area<br>> ><br>> > if given == 3:<br>> > circumference=raw_input("Enter Circumference:")<br>> > radius=(circumference/3.14/2)<br>> > diameter=(radius*2)<br>> > area=(radius**2*3.14)<br>> > print "Radius:", radius<br>> > print "Diameter:", diameter<br>> > print "Area:", area<br>> ><br>> > if given == 4:<br>> > area=raw_input("Enter Area:")<br>> > radius=(area/3.14)<br>> ><br>> > This is the whole program so far, because I haven't quite finished it yet.<br>> > But I tried to get it to display another list of options after you select a<br>> > shape but it just does this.<br>> ><br>> > Pick a shape:<br>> > 1 Circle<br>> > 2 Square<br>> > 3 Triangle<br>> > >1<br>> > >1<br>> > >>><br>> ><br>> > I'm not sure why it does that but I do know that it is skipping the second<br>> > list of options.<br>> ><br>> > Another of my problems is that I can't figure out how to get it to accept<br>> > two different inputs for a selection. Like I want it to accept both the<br>> > number 1 and circle as circle then list the options for circle. It won't<br>> > even accept words. I can only get it to accept numbers. It's quite<br>> > frustrating actually.<br>> ><br>> > Any advice would be greatly appreciated.<br>> > Thanks in advance,<br>> > Adam<br>> ><br>> ><br>> ><br>> ><br>> ><br>> > I tried to get it to display ano<br>> ><br>> > ________________________________<br>> > Add some color. Personalize your inbox with your favorite colors. Try it!<br>> > _______________________________________________<br>> > Tutor maillist - Tutor@python.org<br>> > http://mail.python.org/mailman/listinfo/tutor<br>> ><br>> ><br>> <br>> <br>> -- <br>> Andre Engels, andreengels@gmail.com<br>> 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>