Question: In this lab, you will complete a Python program that swaps values stored in three int variables and determines maximum and minimum values. The Python
In this lab, you will complete a Python program that swaps values stored in three int variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary variable initializations, as well as the input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write statements that compare the values and swap them, if appropriate. Comments included in the code tell you where to write your statements
Instructions
Write the statements that test the first two integers and swap them, if necessary.
Write the statements that test the second and third integer and swap them, if necessary.
Write the statements that test the first and second integers again and swap them, if necessary.
Execute the program using the following sets of input values:
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
second
third
# Get user input.
firstNumber inputEnter first number:
if firstNumber :
secondNumber inputEnter second number:
thirdNumber inputEnter third number:
# Convert strings to int.
first intfirstNumber
second intsecondNumber
third intthirdNumber
# Test to see if the first number is greater than the second number.
# Test to see if the second number is greater than the third number.
# Test to see if the first number is greater than the second number again.
# Print values in numerical order.
printSmallest: first
printNext largest:", second
printLargest: third
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
