Computer Science, asked by Prathyush6E, 8 months ago

Write a Python program to find the addition, multiplication and average of any 3 numbers. (Eg, 3,6,8) Also write code to check if the average is an odd or an even number. I will mark the answer brainliest

Answers

Answered by jai696
4

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

def add(nums):

_sum = 0

for n in nums:

_sum += n

return _sum

def prod(nums):

_prod = 1

for n in nums:

_prod *= n

return _prod

avg = lambda nums: add(nums) / len(nums)

even_odd = lambda n: "even" if n % 2 == 0 else "odd"

nums = [float(n) for n in input("enter 3 nums: ").split()]

avg_nums = avg(nums)

print(f"Sum: {add(nums)}\nProduct: {prod(nums)}\nAvg: {avg_nums:.2f}")

print(f"The avg is {even_odd(avg_nums)}")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions