标签:
看来,我看的教程版本太低了,很多东西都值得推敲。除了小坑print(""),又出现了小坑2input()......
>>> x=input("x:")
x:2
>>> y=input("y:")
y:2
>>> print("x*y")
x*y
>>> print(x*y)
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
print(x*y)
TypeError: can‘t multiply sequence by non-int of type ‘str‘
>>> x
‘2‘
>>> y
‘2‘
>>> int(x)
2
>>> int(y)
2
>>> print(int(x)*int(y))
4
>>>
标签:
原文地址:http://www.cnblogs.com/liuhuan2368935760/p/4655566.html