Answer to Question #230050 in Python for Aditi

Question #230050

Write a python program that asks the user to input six numbers and then print the summation and average of odd numbers only.

Sample Input:

3

5

2

4

8

9

Sample Output: Summation is 17 and average is 5.666666666666667


1
Expert's answer
2021-08-27T02:04:06-0400
n=input('Enter the integers seperated by comma :')
x=n.split(',')
z=[]
for i in x:
    if int(i)%2!=0:
        z+= [int(i)]
print(z)


print('sum',sum(z))
print('average',sum(z)/len(z))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS