1. input()默认是str类型,如果进行计算,需要手动转换成int型数据
>>> x =input('x:=') x:=4 >>> y =input('y:=') y:=4 >>> print(x*y) Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> print(x*y) TypeError: can't multiply sequence by non-int of type 'str' >>> print(int(x)*int(y)) 16 >>>