Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions