Question: I am receiving this feedback using the code given. Unsure what I am doing wrong. Status: FAILED! Check: 1 Test: The program correctly sorts 1

I am receiving this feedback using the code given. Unsure what I am doing wrong.
Status: FAILED!
Check: 1
Test: The program correctly sorts 101,22, and -23
Reason: Unable to find '['Smallest: -23, Next largest: 22, Largest: 101']' in the program's output.
Enter the first:Enter the second:Enter the third:smallest: -23
next smallest: 22
greatest: 101
.
Error : AssertionError -
Timestamp: 2024-04-1022:03:09.892336
Status: FAILED!
Check: 2
Test: The program correctly sorts 630,1500, and 9
Reason: Unable to find '['Smallest: 9, Next largest: 630, Largest: 1500']' in the program's output.
Enter the first:Enter the second:Enter the third:smallest: 9
next smallest: 630
greatest: 1500
.
Error : AssertionError -
Timestamp: 2024-04-1022:03:09.909196
Status: FAILED!
Check: 3
Test: The program correctly sorts 630,1500, and 9
Reason: Unable to find '['Smallest: 2, Next largest: 2, Largest: 21']' in the program's output.
Enter the first:Enter the second:Enter the third:smallest: 2
next smallest: 2
greatest: 21
.
Error : AssertionError -
This is the code entered:
# Swap.py - This program determines the minimum and maximum of three values input by
# the user and performs necessary swaps.
# Input: Three int values.
# Output: The numbers in numerical order.
# Initialize variables.
first =101
second =22
third =-23
# Get user input.
#values input.
first=int(input("Enter the first:"))
second=int(input("Enter the second:"))
third=int(input("Enter the third:"))
if(first>second): #check if first number is greater then swap it.
temp=first
first=second
second=temp
if(second>third): # check if second number is greater then swap it.
temp=second
second=third
third=temp
if(first>second): #lastly again check if first number is greater then swap it.
temp=first
first=second
second=temp
#print in numerical order.
print("smallest:",first)
print("next smallest:",second)
print("greatest:",third)

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