Question: Write a program that sorts three given numbers from smallest to largest. a . Ask the user to input three numbers, one at a time,

Write a program that sorts three given numbers from smallest to largest.
a. Ask the user to input three numbers, one at a time, and save the numbers to a list.(Hint: you need to create an empty list first.)
b. Your program refers to each number using index and do the comparisons. Use nested conditions, not loops or sorting functions. (How many comparisons do we need to decide the order of three numbers? For instance, first layer to compare theList[0] and theList[1], what to compare in the second layer? Is there a third layer?)
Example: input -3,98,73, one at a time
output -[3,73,98]

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!