Select Page

Berkshire Community College Functions Sorting Numbers Python Project

Question Description

Part 1

Write a function called removeNegatives that takes a list of numbers called nums and an empty lists called negatives. Your function should return false if nums is empty and true otherwise. Your function should be placed in a file called RemoveNegatives.py.

Part2

Edit the function removeNegatives so that it adds all of the negative numbers in nums to the list called negatives. The order of the negative numbers in negatives should be determined by the order the numbers appear in nums.

Part 3

Edit the function removeNegatives so that it removes all of the negative numbers from nums.

Here is a sample run of the completed program:

Enter a number (-1 to quit): 3Enter a number (-1 to quit): -4Enter a number (-1 to quit): -2Enter a number (-1 to quit): 43Enter a number (-1 to quit): 7Enter a number (-1 to quit): 1Enter a number (-1 to quit): -1Negatives: [-4,-2]Nums: [3, 43, 7, 1]Returned: True 

NOTE: The order of the negative numbers in negatives is determined by the order the numbers appear in nums.

"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."

Order Solution Now