Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

=+5. Should public employees be allowed to strike?

Answered: 1 week ago