-3
我一直在我正在做的程序中的一行代碼有一些問題。當過我運行該文件,它會顯示此消息:需要幫助。 Python整數和字符串
Traceback (most recent call last):
File "C:\Users\Main\Google Drive\computerprograming\mathoperationscalc.py", line 9, in <module>
print('the sum of ' + x + ' and ' + y + ' is ')
TypeError: Can't convert 'int' object to str implicitly
下面是代碼:
print('please input 1st integer')
x = input()
x = int(x)
print('please input 2nd integer')
y = input()
y = int(y)
Sum = x + y
print('the sum of ' + x + ' and ' + y + ' is ')
print(Sum)
(或任何其他650個SO問題,如果你不屑於谷歌的錯誤消息,你會得到。) – jonrsharpe 2014-10-03 16:36:30