Home /
Expert Answers /
Computer Science /
i-need-help-writing-the-code-that-will-determine-my-largest-and-smallest-number-understanding-if-pa206
(Solved): I need help writing the code that will determine my largest and
smallest number.
Understanding if ...
I need help writing the code that will determine my largest and
smallest number.
Understanding if else Statements Summary In this lab, you complete a prewritten Python program that computes the largest and smallest of three integer values. Instructions 1. Two variables named largest and smallest are assigned for you. Use these variables to store the largest and smallest of the three integer values. You must decide what other variables you will need and initialize them if appropriate. 2. Your program should prompt the user to enter 3 integers. 3. Write the rest of the program using assignment statements, and if else statements as appropriate. There are comments in the code that tell you where you should write your statements. The output statements are written for you. 4. Execute the program by clicking the Run button at the bottom of the screen. Using the input of -50, 53, 78, your output should be: The largest value is 78 The smallest value is -50 + LargeSmall.py 1 # Large Small.py - This program calculates the largest and smallest of three integer values. 2 # Declare and initialize variables here 3 largest None 4 smallest = None 5 6 # Prompt the user to enter 3 integer val 7 firstNumber = -50 8 secondNumber = 53 9 thirdNumber = 78 10 # Write assignments, and necessary if else statements here as appropriate 11 12 # Output largest and smallest number. 13 print ("The largest value is " + str(largest)) 14 print ("The smallest value is " + str(smallest)) 15
Answer: The python source code for the given problem is : #python program to find the largest and smallest among three largest=None smallest=None firstNumber=int(input("