Answer to Question #232601 in Python for Assignment

Question #232601
Write a Python code that will read 10 numbers from the user, and then display the total
and the average of ONLY the odd numbers among those ten numbers.
1
Expert's answer
2021-09-06T00:16:36-0400


Num = str(input("Enter numbers followed by SPACE: ")).split(" ")


Sum=0
n=0
for r in range(0,len(Num)):
      if(int(Num[r])%2==1):
            Sum = Sum + int(Num[r])
            n=n+1
print("Sum of Odd Numbers : ",Sum)
print("Avg. of Odd Numbers: ",(Sum/n))

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