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

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

1 Expert Approved Answer
Step: 1 Unlock

Python code def countevenoddlist1 evencount 0 oddcount 0 for num in list1 if num 2 0 evencount 1 els... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!