1 a=0 2 for n in range(1,1000): 3 if n%3==0 or n%5==0: 4 a=a+n 5 print(a) 运行结果: 233168 转载于:https://www.cnblogs.com/pangzx/p/9222191.html