Question: This is the question: Write 3 functions list input(), even sum() and odd sum(). list input() should get a list of numbers from user while
This is the question:
Write 3 functions listinput(), evensum() and oddsum(). listinput() should get a list of numbers from user while evensum should return the sum of all the even numbers in the given list, and oddsum should return the sum of all the odd numbers in the given list.
This is my code:
input=[] even_Sum = 0 odd_Sum = 0 for number in input: if(number % 2 == 0): even_Sum = even_Sum + number else: odd_Sum = odd_Sum + number print("Sum of Even Numbers: {0},".format(even_Sum),'',end='') print("Sum of Odd Numbers: {0}".format(odd_Sum))
Can you help me to fix my code so that it can receive any input from the program? Input example are 99, 99, 99, 99, 99, 99, 99, 99, 99, 99. In python pls
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
