Question: Python Complete the definition of the function called count_even_odd(lst)that takes a list of integers lst and calculates the number of even numbers in the list
Python
Complete the definition of the function called count_even_odd(lst)that takes a list of integers lst and calculates the number of even numbers in the list lst and stores it in the index 0 of a new list called count . Similarly, the function calculates the number of oddnumbers in the list lst and stores it in the index 1 of the list called count. In the end of the function definition, we will return the list called count which contains two elements that represent the count of even numbers and odd numbers at indices 0 and 1 respectively.
We have written the code to read the input from the user in the background. Also, the code challenge will call your function with many input lists and check that it behaves correctly on all of them. Your task is to only complete the definition of the function as specified.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
