我在这个简单的程序中做错了什么?提前致谢。基本程序类型错误。我究竟做错了什么?
>>> x=input("x: ")
x: 2
>>> y=input("y: ")
y: 4
>>> print (y*x)
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
print (y*x)
TypeError: can't multiply sequence by non-int of type 'str'
>>>
你不能乘以'str's,这是'input()'给你的。例如,“汤姆”是什么?“苹果”? – csmckelvey 2014-11-24 05:09:14