我使用Python 3.6.2在Windows 64位,我有一个错误:引发TypeError ....Python的类型错误:必须海峡,不是int
A = 0
ns = input('Input start:')
nf = input('Input finish:')
steps = input('Input steps:')
for i in range(steps + 1):
d_n = (nf-ns)/steps
n = ns + i * d_n
f_n = n*n
A = A + f_n * d_n
next
print('Area is: ', A)
而这里的错误....
Traceback (most recent call last):
File "C:/Users/UNO/Documents/Python 3.6/Curve_Area2.py", line 5, in
<module>
for i in range(steps + 1):
TypeError: must be str, not int
而且我想这个结果....
Input start:3
Input finish:5
Input steps:100000
Area is: 32.66700666679996
我不知道如何解决这个问题...请帮助!!!!
什么是“下一个”,它在我的系统上工作正常。 –
我的意思是这个!!!!!!!! – sjkim104
'input()'返回一个字符串。将其转换为int()' – hop