#解法1 def solution(number): multi_num=0 for num in range(number): if num%3==0 or num%5==0: multi_num+=num return multi_num #解法2 def solution2(number): return sum(i for i in range(number) if i%3==0 or i%5==0) print(solution(10))
#解法1 def solution(number): multi_num=0 for num in range(number): if num%3==0 or num%5==0: multi_num+=num return multi_num #解法2 def solution2(number): return sum(i for i in range(number) if i%3==0 or i%5==0) print(solution(10))