Guest User

Untitled

a guest
Apr 26th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. # If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
  2. # Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.
  3.  
  4. def solution(number):
  5. total = 0
  6. for n in range(number):
  7. if n % 3 == 0 or n % 5 == 0:
  8. total += n
  9. return total
Add Comment
Please, Sign In to add comment