Question: 1. Question: Write a Python program to use if-else condition statement to count the SUM of odd numbers, and the AVERAGE of even numbers, from
1. Question: Write a Python program to use if-else condition statement to count the SUM of odd numbers, and the AVERAGE of even numbers, from numbers from USERS' INPUT (from user's input one by one, until reach a definite number of inputs as user decided).
coding so far...it works sometimes. Idk what I'm doing wrong.
def main(): n=int(input("How many number user want: ")) list=[] odd_sum=0 even_sum=0 even_num=0 print("Enter numbers: ") for i in range(0,n): list.append(int(input())) for i in range(0,n): if(list[i]%3==0): odd_sum=odd_sum+list[i] else: even_sum=even_sum+list[i] even_num=even_num+1 print("Odd sum is: ",odd_sum) print("Average of Even is: ",even_sum/even_num) main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
