Write a program that uses the while-loop that asks the user to enter integer numbers. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that uses the while-loop that asks the user to enter integer numbers. The user has to enter quit to quit the program. Put all the integers into a list and then use the Selection Sort Algorithm to sort the numbers from largest to smallest. The program must work exactly like the following examples. For example: Input Result 28 18 38 68 58 48 quit Enter an integer (or enter quit): 20 Enter an integer (or enter quit): 10 Enter an integer (or enter quit): 30 Enter an integer (or enter quit): 60 Enter an integer (or enter quit): 50 Enter an integer (or enter quit): 40 Enter an integer (or enter quit): quit Selection Sort Algorithm for [20, 10, 30, 60, 50, 40] After round e: [60, 10, 30, 20, 50, 40] After round 1: [60, 50, 30, 20, 10, 40] 50, 40, 20, 10, 30] After round 3: [60, 50, 40, 30, 10, 201 After round 2: [60, After round 4: [60, 50, 40, 30, 20, 10] Write a program that uses the while-loop that asks the user to enter integer numbers. The user has to enter quit to quit the program. Put all the integers into a list and then use the Selection Sort Algorithm to sort the numbers from largest to smallest. The program must work exactly like the following examples. For example: Input Result 28 18 38 68 58 48 quit Enter an integer (or enter quit): 20 Enter an integer (or enter quit): 10 Enter an integer (or enter quit): 30 Enter an integer (or enter quit): 60 Enter an integer (or enter quit): 50 Enter an integer (or enter quit): 40 Enter an integer (or enter quit): quit Selection Sort Algorithm for [20, 10, 30, 60, 50, 40] After round e: [60, 10, 30, 20, 50, 40] After round 1: [60, 50, 30, 20, 10, 40] 50, 40, 20, 10, 30] After round 3: [60, 50, 40, 30, 10, 201 After round 2: [60, After round 4: [60, 50, 40, 30, 20, 10]
Expert Answer:
Answer rating: 100% (QA)
The required python program def selectionsortarr n lenarr for i in range... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Repeat question 65 to determine the followin. Data in question 65. Complete the truth table for the following sequential circuit. a) The output string generated for the input: 00101101. b) In which...
-
Microkernel operating systems aim to address perceived modularity and reliability issues in traditional "monolithic" operating systems. (i) Describe the typical architecture of a microkernel...
-
Income statements for the current year and one year ago follow. Assume that all sales are on credit. For Year Ended December 31 Sales Cost of goods sold Other operating expenses Interest expense...
-
The U.S. federal courts are accepting too many lawsuits initiated by foreigners that concern matters not relevant to this country. Explain
-
Ed has supported his stepdaughter, her husband, and their child since his wifes death three years ago. Ed promised his late wife that he would support her daughter from a former marriage and her...
-
The following data are for Huang Wong Ping Retail Outlet Stores. The account balances (in thousands) are for 2017. 1. Compute (a) the cost of goods purchased and (b) the cost of goods sold. 2....
-
a. Create a spreadsheet model for this problem and solve it. What is the optimal solution? b. If Rick wanted to improve this solution, what additional resources would be needed and where would they...
-
Blood Money" podcast: What are the uses of human plasma? What is the argument for and against allowing private companies to pay for plasma? Does allowing payment for human bioproducts exploit...
-
Nutrition is often talked about in everyday pop culture. Nutrition science, however, is not always part of the conversation. Respond to the following in a minimum of 175 words: Discuss some examples...
-
Describe the process of implementing a just-in-time (JIT) compiler for Python and the potential performance benefits.
-
On April 1, 2023, Arnold, Bryan and Mathieu form a limited liability partnership to start a small public accounting firm. Arnold, Bryan and Mathieu have invested $97,000, $47,000 and $54,000...
-
Instacart allows an individual who needs groceries (the principal) to hire a personal shopper (the agent) to go to the store and buy their groceries for them. The principal makes a list of grocery...
-
1)What is project portfolio management and why is it becoming so important for organizations? 2) You have a sports store in Toronto that has been closed since the beginning of the pandemic. Recently...
-
Ethics is an important part of research. It is vital to understand how ethical considerations may change for clinical research. Some ethical considerations for research are as follows: Do not cause...
-
Offer at least 2 examples of collaborative efforts in the field of gerontology.
-
Suppose that A is square matrix, prove that: the sum of its eigenvalues is equal to the trace of A; the product of its eigenvalues is equal to the determinant of A.
-
Consider a closed, rigid tank with a volume of 0.8L, filled with cold water initially at 27C. The tank is filled such that there are no voids (air pockets) within. The initial pressure within the...
-
Modify the Student class in Listing 8.2 so that it implements the comparable interface. Define the compareTo method to order Student objects based on the value in studentNumber. In a main method...
-
What is the value of each of the following boolean expressions if x is 5,y is 10, and z is 15? a. (x < 5 && y > x) b. (x < 5 || y > x) c. (x > 3 || y < 10 && z == 15) d. (! (x > 3) && x!= z || x + y...
-
Suppose we want to compute the amount of money in a bank account with compound interest. If the amount of money in the account is m, the amount in the account at the end of the month will be 1.005m....
-
On January 2, 2018, The Register, a science and technology news site based in Britain, published an article revealing the existence of two major bugs leaving virtually all computers and smartphones...
-
In the 1970s, Special Electric Company brokered the sale of crocidolite asbestos, which is the most toxic form of asbestos, to Johns- Manville Corporation. Special Electric never held possession of...
-
Plaintiffs W. O. and J. C. Lucy had wanted to purchase Ferguson Farm from the Zehmers for at least eight years. One night, Lucy stopped by the establishment the Zehmers operated and said that he bet...
Study smarter with the SolutionInn App