Question: Write a python function that does the following: If we list all the natural numbers below 1 0 that are multiples of 3 or 5

Write a python function that does the following:
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.
Find the sum of all the multiples of 3 or 5 below 1000.
The function should take 2 parameters named multiples and up_to_exclusive. Multiples would be a list and up_to_exclusive an integer. It should return all numbers that are multiples of values in the list that are less than up_to_exclusive.
For example, in case above, the function call would look like:
result = compute_sum_of(multiples=[3,5], up_to_exclusive=10)
print(result)
The output value would be: 23
Then do the same for:
result = compute_sum_of(multiples=[3,5], up_to_exclusive=1000)
print(result)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!