[Tutor] trouble with "if"

Eric Walstad eric at ericwalstad.com
Wed May 23 18:14:53 CEST 2007


adam urbas wrote:
> Hi all,
> 
> I've been working with this new program that I wrote.
...
>     #"User's Choice:"
> shape=raw_input("> ")
>
>         #"Select Given:"
> if shape == 1:
...


ewalstad at uluwatu:~$ python
Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> shape = raw_input('>')
>1
>>> type(shape)
<type 'str'>
>>> shape == 1
False
>>>


HTH,

Eric.


More information about the Tutor mailing list