Question: Define the get_list_nums_without_9() function which is passed a list of numbers as a parameter. The function returns a new list containing all the numbers (integers)
Define the get_list_nums_without_9() function which is passed a list of numbers as a parameter. The function returns a new list containing all the numbers (integers) from the parameter list which do not contain the digit 9. If the parameter list is empty or if all of the numbers in the parameter list contain the digit 9, the function should return an empty list. For example, the following code:
Test
print("1.", get_list_nums_without_9([589775, 677017, 34439, 48731548, 782295632, 181967909])) print("2.", get_list_nums_without_9([6162, 29657355, 5485406, 422862350, 74452, 480506, 2881])) print("3.", get_list_nums_without_9([292069010, 73980, 8980155, 921545108, 75841309, 6899644])) print("4.", get_list_nums_without_9([])) nums = [292069010, 73980, 8980155, 21545108, 7584130, 688644, 644908219, 44281, 3259, 8527361, 2816279, 985462264, 904259, 3869, 609436333, 36915, 83705, 405576, 4333000, 79386997] print("5.", get_list_nums_without_9(nums)) Expected
1. [677017, 48731548] 2. [6162, 5485406, 422862350, 74452, 480506, 2881] 3. [] 4. [] 5. [21545108, 7584130, 688644, 44281, 8527361, 83705, 405576, 4333000]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
