Question: Write a function named count_even_odd that takes in a list as an argument. The list will contain only numbers in it. Return a list
Write a function named count_even_odd that takes in a list as an argument. The list will contain only numbers in it. Return a list with two elements in it, the number of even numbers and the number of odd numbers. The number of even numbers must be first. Examples: count_even_odd ([2, 3, 4, 5, 6]) returns [3, 2] count_even_odd ([43, 12, .0, 372, 1, -5]) returns [3, 3] count_even_odd ([3) returns [0, 0]
Step by Step Solution
3.48 Rating (155 Votes )
There are 3 Steps involved in it
Python code def countevenoddlist1 evencount 0 oddcount 0 for num in list1 if num 2 0 evencount 1 els... View full answer
Get step-by-step solutions from verified subject matter experts
