Question: a- Write a Python function new_List that prompts the user to enter non-negative integers. The function should keep on entering the integers and adding

a- Write a Python function new_List that prompts the user to enter

 

a- Write a Python function new_List that prompts the user to enter non-negative integers. The function should keep on entering the integers and adding them to a list until a negative number is entered. Make sure that this list can be used in other parts of a program. (12 marks) b- Suppose that we want to call the above function and print the list of numbers that are multiples of 2 and 3 and the list of the remaining numbers. Write down the statements that implement the task. (8 marks) Expected Output: Enter a non-negative integer, any negative integer to stop 0 Enter a non-negative integer, any negative integer to stop 4 Enter a non-negative integer, any negative integer to stop 6 Enter a non-negative integer, any negative integer to stop 9 Enter a non-negative integer, any negative integer to stop 10 Enter a non-negative integer, any negative integer to stop 12 Enter a non-negative integer, any negative integer to stop 18 Enter a non-negative integer, any negative integer to stop 21 Enter a non-negative integer, any negative integer to stop -1 The elements that are multiples of 2 and 3 are: [0, 6, 12, 18] The remaining elements are: [4, 9, 10, 211

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 Databases Questions!