我正在编写一个计算器,当我运行程序时,出现了这个错误消息:Traceback (most recent call last): File "/Users/sergioley-languren/Documents/itt/independent_projects/Mathematical_Calculator.py", line 66, in <module> print(x + "+" + y + "=" + mathResult + ".") ; sleep(float(speed))TypeError: unsupported operand type(s) for +: 'int' and 'str'这是出现错误的代码:print("type in your addition problem with your x variable first. (x variable = your first number) CAUTION: This calculator only supports 2 numbers at the moment.") ; sleep(float(speed)) x = int(input()) print("Type in your y variable.") ; sleep(float(speed)) y = int(input()) mathResult = x + y print(x + "+" + y + "=" + mathResult + ".") ; sleep(float(speed))
添加回答
举报
0/150
提交
取消