标签: python python-3.x
i =0 for n in range(1,1000) : if n % 3 == 0 or n % 5 == 0 : i += n print(i)
如何直接打印最后一张?
答案 0 :(得分:0)
只需将print(i)移出for循环就可以了。
print(i)
i = 0 for n in range(1, 1000): if n % 3 == 0 or n % 5 == 0: i += n print(i)