[英]Python user input and mathematical operation error
>>> g = input("Enter a number")
Enter a number43
>>> g + 2
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
g + 2
TypeError: Can't convert 'int' object to str implicitly
The program wont let me use the input variable in mathematical operations, like g + 2
该程序不会让我在数学运算中使用输入变量,例如
g + 2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.