[英]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
該程序不會讓我在數學運算中使用輸入變量,例如g + 2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.