Question: using python !! Write a function printTwoLargest() that inputs an arbitrary number of positive numbers from the user. The input of numbers stops when the

using python !!

Write a function printTwoLargest() that inputs an arbitrary number of positive numbers from the user. The input of numbers stops when the first negative or zero value is entered by the user. The function then prints the two largest values entered by the user. If no positive numbers are entered a message to that effect is printed instead of printing any numbers. If only one number is inputted, only the largest is printed out (see 2nd example below). Sample output:

>>> printTwoLargest()

Please enter a number: 12

Please enter a number: 99.9

Please enter a number: 4.5

Please enter a number: 77

Please enter a number: 0

The largest is 99.9

The second largest is 77

>>> printTwoLargest()

Please enter a number: 23.2

Please enter a number: -99

The largest is 23.2

>>> printTwoLargest()

Please enter a number: -9

No positive numbers were entered

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