[Tutor] this is hard

alan.gauld@bt.com alan.gauld@bt.com
Wed, 21 Aug 2002 17:21:42 +0100


>  why wont this work? When you type 1 noting happenes 

Quite a subtle problem for a beginner to spot.
 

> input = raw_input("type 1 for a rectangle")
> if input == 1:
 
Here you create a name 'input' and make it receive the 
value returned by raw_input. In so doing you hide the 
name of the built in function 'input()' so that
   
>      heigth = input("please type height here:")

you can't call this function now. You say nothing happens? 
I would have expected you to get an error, p[robably something 
about callable objects or similar.

Try replaving input() with:

      height = int(raw_input("Type a height here"))

Which will convert the users value into an integer.
Either that or change the name of your variable above 
to something other than 'input' - say value?

Alan g.