On 5/27/07, adam urbas <[EMAIL PROTECTED]> wrote:

> It says:
>
> can't multiply sequence by non-int of type 'str'

The reason is that raw_input() returns a string. What you are trying
to do is multiply a string with a string, which - in Python - is an
illegal operation.

What you want to do is to convert the read value from raw_input() to
an integer, and then multiply. You convert with the function int(). So
if you change the two upper lines of your code test.py to

height = int(raw_input("enter height:"))
width = int(raw_input("enter width:"))

then the multiplication will work. It will - however - not work if you
don't enter a numerical value, because int() will fail for everything
else than numericals.

HTH.


-- 
- Rikard - http://bos.hack.org/cv/
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to