Question: Write a Python program that includes a function num_List that prompts the user to enter a non-negative integer (negative to stop) and add it to
Write a Python program that includes a function num_List that prompts the user to enter a non-negative integer (negative to stop) and add it to the list my listf which is initially empty. The program should call num_list function, create a new list my_list2 which should be filled with all elements in my _list1 that are either multiples of 3 or multiples of 7 , and finally, print my _list2. Expected Output: Enter a non-negative integer, any negative integer to stop 5 Enter a non-negative integer, any negative integer to stop 6 Enter a non-negative integer, any negative integer to stop 0 Enter a non-negative integer, any negative integer to stop 21 Enter a non-negative integer, any negative integer to stop 7 [6,0,21]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
