Question: PROGRAM NEEDS TO BE IN PYTHON: Create a list of numbers that will be filtered into two separate lists based on their sign (positive or
PROGRAM NEEDS TO BE IN PYTHON: Create a list of numbers that will be filtered into two separate lists based on their sign (positive or negative).
1) Define a function 'filterNumbers()' with parameter 'values' (which is a list with values [4, -2, -5, -9, 0, 1, 19])
2) Create 2 empty lists in the function (one for positive values, one or negative values)
3) Loop through all values in the 'values' list and sort each value into each list based on sign (assume 0 as positive)
4) Create a tuple which contains 2 elements (positive list and negative list) and return the tuple
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
