Question: Examine the following code: negatives = zeros = positives = line = input(Enter an integer (blank to quit): ) while line != : num =

 Examine the following code: negatives = zeros = positives = line

Examine the following code: negatives = zeros = positives = line = input("Enter an integer (blank to quit): ") while line != "": num = int(line) if num 0: 16 positives.append(num) 11 else: 12 zeros.append(num) 13 line = input("Enter an integer (blank to quit): ") 14 for n in negatives: 15 print(n) 16 for n in zeros: 17 print(n) 18 for n in positives: 19 print(n) wmummpwmp Answer the following: a. What is the purpose of the code? Explain the working of the code by taking 10 sample inputs containing positive, negative and zeros. First input should be the last two digits of your roll number and second input should be the number of your month of birth (e.g. input 7 if you were born in July). b. In your opinion, is it possible to generate the same functionality of code by using other data structure(s)? Transform the above code by using other appropriate data structure(s) such that overall function (purpose) of the code remains the same

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!