method1:
def solu(num):
nums = list(range(1,10))sum=0for i in nums: if i % 3 == 0 or i % 5 == 0: sum += ireturn summethod2:def solu(num): return sum(i for i in (list(range(1,num))) if i%3==0 or i%5==0)
posted on 2017-07-07 15:20 run_qin 阅读(206) 评论(0) 编辑 收藏 举报