Write a Python code of a program that asks the user to enter ten numbers then display
the total and the average of ONLY the even numbers among those ten numbers.
1
Expert's answer
2021-09-06T01:59:20-0400
from functools import reduce
N = list(map(int,input().split()))
def fun(x):
if x % 2 == 0:
return x;
even_numbers = list(filter(fun,N))
sum_num = reduce(lambda x,y:x+y,even_numbers)
print(sum_num,sum_num/len(even_numbers))
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment