<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body><div style="text-align: left;">I figured out why it was asking for the radius of a square.&nbsp; It was because I had the if shape==1: thing on there.&nbsp; I was typing in rectangle and that was an else: function.&nbsp; <br><br>How do i get it to accept both 1 and circle?&nbsp; I learned not to use else: unless I was completely sure that I could use it, to avoid problems like this.<br></div><br>I put both the .py and .txt files on there, so which ever you prefer.<br><br>Thanks,<br>Adam<br><br><hr id="stopSpelling">&gt; To: tutor@python.org<br>&gt; From: alan.gauld@btinternet.com<br>&gt; Date: Sat, 19 May 2007 08:28:19 +0100<br>&gt; Subject: Re: [Tutor] two input acceptions<br>&gt; <br>&gt; <br>&gt; "Rolando Pereira" &lt;finalyugi@sapo.pt&gt; wrote<br>&gt; &gt; what did you mean when you were talking about the raw_input( )?  <br>&gt; &gt; How can the regular input( ) be used evilly?  <br>&gt; <br>&gt; raw_input() is the preferred way to read input from a user.<br>&gt; It only reads the raw input as typed by the user  so it always <br>&gt; returns a string which you then need to convert to another <br>&gt; type (like an int) if you need to. This gives you more controil <br>&gt; over what kind of data your program receives.<br>&gt; <br>&gt; input() by contrast reads the string input by the user and tries <br>&gt; to evaluate it as a Python expression. Thus if the user typed<br>&gt; <br>&gt; import os;os.system('format c:\')<br>&gt; <br>&gt; Python would try to evaluate that as a python string <br>&gt; and it could format your C drive. (In practice it would <br>&gt; throw up a prompt and hopefully you would say no!)<br>&gt; It might not be something as obvious as that, it <br>&gt; could simply deactivate your firewall, or add a new <br>&gt; user account to your PC, anything that enables a <br>&gt; subsequent attack to do more damage.<br>&gt; <br>&gt; The attack might not be deliberate, sometimes <br>&gt; accidentally typed errors can result in code being <br>&gt; executed that you didn't want.<br>&gt; <br>&gt; But thats why input() is best used in very strictly <br>&gt; controlled environments - like at the &gt;&gt;&gt; prompt when <br>&gt; you are testing/developing code. But use raw_input plus <br>&gt; a conversion function for finished code.<br>&gt; <br>&gt; &gt; When I run the program and input the rectangle option, <br>&gt; &gt; it asks me for a radius, <br>&gt; <br>&gt; Your code is unreadable and I don't have the time <br>&gt; or inclination to try to unpick it. Can you send as plain <br>&gt; text or as an attachment please?<br>&gt; <br>&gt; Alan G<br>&gt; <br>&gt; _______________________________________________<br>&gt; Tutor maillist  -  Tutor@python.org<br>&gt; http://mail.python.org/mailman/listinfo/tutor<br><br /><hr />Add some color. Personalize your inbox with your favorite colors. <a href='www.windowslive-hotmail.com/learnmore/personalize.html?locale=en-us&ocid=RMT_TAGLM_HMWL_reten_addcolor_0507' target='_new'>Try it!</a></body>
</html>