<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. It was because I had the if shape==1: thing on there. I was typing in rectangle and that was an else: function. <br><br>How do i get it to accept both 1 and circle? 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">> To: tutor@python.org<br>> From: alan.gauld@btinternet.com<br>> Date: Sat, 19 May 2007 08:28:19 +0100<br>> Subject: Re: [Tutor] two input acceptions<br>> <br>> <br>> "Rolando Pereira" <finalyugi@sapo.pt> wrote<br>> > what did you mean when you were talking about the raw_input( )? <br>> > How can the regular input( ) be used evilly? <br>> <br>> raw_input() is the preferred way to read input from a user.<br>> It only reads the raw input as typed by the user so it always <br>> returns a string which you then need to convert to another <br>> type (like an int) if you need to. This gives you more controil <br>> over what kind of data your program receives.<br>> <br>> input() by contrast reads the string input by the user and tries <br>> to evaluate it as a Python expression. Thus if the user typed<br>> <br>> import os;os.system('format c:\')<br>> <br>> Python would try to evaluate that as a python string <br>> and it could format your C drive. (In practice it would <br>> throw up a prompt and hopefully you would say no!)<br>> It might not be something as obvious as that, it <br>> could simply deactivate your firewall, or add a new <br>> user account to your PC, anything that enables a <br>> subsequent attack to do more damage.<br>> <br>> The attack might not be deliberate, sometimes <br>> accidentally typed errors can result in code being <br>> executed that you didn't want.<br>> <br>> But thats why input() is best used in very strictly <br>> controlled environments - like at the >>> prompt when <br>> you are testing/developing code. But use raw_input plus <br>> a conversion function for finished code.<br>> <br>> > When I run the program and input the rectangle option, <br>> > it asks me for a radius, <br>> <br>> Your code is unreadable and I don't have the time <br>> or inclination to try to unpick it. Can you send as plain <br>> text or as an attachment please?<br>> <br>> Alan G<br>> <br>> _______________________________________________<br>> Tutor maillist - Tutor@python.org<br>> 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>