为什么会这样:
def p3(x):
primes = [2]
for a in range(3, x, 2):
sqrt = a ** 0.5
for b in range(3, sqrt, 2):
if a % b == 0:
break
if a % b != 0:
primes.append(a)
return primes
print(p3(19))
返回这个:
TypeError: 'float' object cannot be interpreted as an integer, line 5
这是什么意思,我该如何纠正?
提前致谢,
LewisC