Computer Science, asked by pawantxkumar, 1 month ago

WAP to find the product of first 5 multiples of 3 and also print the output.

Please give me asnwer dont scam​

Answers

Answered by SherlockHolmes221b
1

Answer:

#this function calculates and returns a list of multiple(s) of a given number upto the given count(like 5 multiples of 3)

def multiple_of(num, count = 1):

multiples = []

for (i in range(num, num*count + 1, num)):

multiples.append(i)

return multiples

#this function multiples all elements of a list and returns the answer

def multiply_list(num_list):

answer = 1

for (num in num_list):

answer *= num

return answer

#this function combines the above two functions and returns the answer

def product_of_multiples(num, count = 1):

return multiply_list(multiple_of(num, count))

product_of_five_multiples_of_three = product_of_multiples(3, 5)

print(product_of_five_multiples_of_three)

Similar questions