Python - 类型错误:'tuple'对象不可调用



当我编写这个程序时,它会给我这个错误。为什么?

n = []
for x range(1500, 2701):
if(x % 7 == 0) and (x % 5== 0):
n.append(str(x))
print(",".join(n))
TypeError: 'tuple' object is not callable

试试这个:

n = []
for x in range(1500, 2701):
if x % 7 == 0 and x % 5 == 0:
n.append(str(x))
print(",".join(n))
  • If语句中不需要括号
  • 中缺少。。在

最新更新