<div>Hi,</div>
<div> </div>
<div>Thanks for your reply. It worked.</div>
<div> </div>
<div>Paulo Repreza<br><br></div>
<div class="gmail_quote">On Sat, Jan 31, 2009 at 4:25 PM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com">robert.kern@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">On 2009-01-31 18:19, Paulo Repreza wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br>I'm just learning the very basics of python and I ran into this problem<br>in version 3.0/3000:<br>
>>>x = input("x: ")<br>x: 36<br> >>> y = input("y: ")<br>y: 42<br> >>> print (x*y)<br>Traceback (most recent call last):<br>File "<pyshell#3>", line 1, in <module><br>
print (x*y)<br>TypeError: can't multiply sequence by non-int of type 'str'<br>But when I run the same code with Python 2.6.1 it does prints the result.<br></blockquote><br></div>In Python 3.0, the 2.x input() function, which evaluates the string, was removed, and the 2.x raw_input() function, which just returns the string that was entered, was renamed to input().
<div class="Ih2E3d"><br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Is there any special function that I should add in order to work<br>properly under Python 3.0?<br></blockquote>
<br></div>x = int(input('x: '))<br>y = int(input('y: '))<br><br>-- <br>Robert Kern<br><br>"I have come to believe that the whole world is an enigma, a harmless enigma<br> that is made terrible by our own mad attempt to interpret it as though it had<br>
an underlying truth."<br> -- Umberto Eco<br><font color="#888888"><br>--<br><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br></font></blockquote>
</div><br>