Question: Imagine that someone has written the following code for you, which asks the user to enter a list of arbitrary, unsorted integers, such as [5,

 Imagine that someone has written the following code for you, which

Imagine that someone has written the following code for you, which asks the user to enter a list of arbitrary, unsorted integers, such as [5, 8, 3, 12], and stores this, as a list, in the variable ints below. Complete the code below to print the largest and second largest element of any arbitrary list passed in. You may assume the list is non-empty, and will only contain integers, but you may not make any other assumptions about the list You may write your code in either version of Python; we have started it in the older version as a demonstration. YOU MAY NOT SORT THE LIST OR USE ANY BUILT-IN FUNCTIONS (like min, sort, max, etc.) EXCEPT str () to print out the results. Below are some sample runs: Enter a list of ints, e.g. [4, 5, 6]: [8, 6, 81, 7, 2, 5] largest: 81 next largest: 8 Enter a list of ints, e.g. [4, 5, 6]: [8] largest: 8 next largest: 8 Please write your code below this line. ints = list(input("Enter a list of ints, e.g. [4, 5, 6]: "))

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!