Question: Exercise # 1 While Signs ( use while loop ( s ) ) You know how to determine if numbers are positive or negative (

Exercise #1 While Signs
(use while loop(s))
You know how to determine if numbers are positive or negative (we wrote a
program for it before in lecture class). Let's do more things with positive and
negative numbers! You will create a function that distributes numbers entered by
the user into separate lists of positive and nonnegative numbers (meaning
includes zero and negative numbers). Your program will read numbers from the
keyboard until the user inputs a 'q'.
Name your program while_signs.py. Write a function get_positive_negative()
that:
1. Repeatedly reads keyboard entries until the user inputs a 'q'. The
prompt should be Input? (with a single space after the question mark).
2. Appends each float input into the appropriate list: positive numbers or
nonnegative numbers
3. Returns the two lists as a tuple, positives first.
For instance:
Input? 34
Input? 4
Input? -7
Input? 0
Input? q
([34.0,4.0],[-7.0])

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