Question: Functions Exercise 2 in Python Problem Write a function called odds _ or _ evens that takes a boolean and a list of integers as

Functions Exercise 2 in Python
Problem
Write a function called odds_or_evens that takes a boolean and a list of integers as parameters. If the boolean parameter is True, return a list of only even numbers. If the boolean parameter isFalse, return a list of only odd numbers.
Expected Output
If the function call is odds_or_evens(True,[13,22,8,31]), the the function would return [22,8]
If the function call is odds_or_evens(False,[13,22,8,31]), the the function would return [13,31]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!