Counting evens and odds#
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 odd numbers 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.
Sample Input:
8 11 3 78 30 2
Sample Output:
[4, 2]