Understanding if else Statements in Python Lehl 순 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

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 28PE
icon
Related questions
Question

I'm having issues when running the check with the last part.. it's not passing this part, what am i missing in the code?

 

Program computes the largest and smallest of the following integers: -21, -1, -30.

LargeSmall.py
+
1 # Large Small.py - This program calculates the largest and smallest of three integer val
2 # Declare and initialize variables here
3 firstNumber = "none"
4 secondNumber = "none"
5 thirdNumber = "none"
6 # Prompt the user to enter 3 integer values
7 firstNumber=input("Enter
8 secondNumber=input("Enter
9 thirdNumber=input("Enter
a number please?")
10 # Write assignments, and necessary if else statements here as appropriate
11 if firstNumber > secondNumber:
12
if firstNumber> thirdNumber:
largest = firstNumber
13
14 elif secondNumber> thirdNumber:
15 if secondNumber › firstNumber:
16
largest = secondNumber
17 else:
18
largest = thirdNumber
19
20 if firstNumber< secondNumber:
21
if firstNumber < thirdNumber:
smallest = firstNumber
22
23 elif secondNumber< thirdNumber:
24
if secondNumber< firstNumber:
smallest = secondNumber
25
56
a number please?")
a number please?")
26 else:
27
28
29 # Output largest and smallest number.
30 print("The largest value is " + str(largest))
31 print("The smallest value is " + str(smallest))
32
smallest = thirdNumber
Transcribed Image Text:LargeSmall.py + 1 # Large Small.py - This program calculates the largest and smallest of three integer val 2 # Declare and initialize variables here 3 firstNumber = "none" 4 secondNumber = "none" 5 thirdNumber = "none" 6 # Prompt the user to enter 3 integer values 7 firstNumber=input("Enter 8 secondNumber=input("Enter 9 thirdNumber=input("Enter a number please?") 10 # Write assignments, and necessary if else statements here as appropriate 11 if firstNumber > secondNumber: 12 if firstNumber> thirdNumber: largest = firstNumber 13 14 elif secondNumber> thirdNumber: 15 if secondNumber › firstNumber: 16 largest = secondNumber 17 else: 18 largest = thirdNumber 19 20 if firstNumber< secondNumber: 21 if firstNumber < thirdNumber: smallest = firstNumber 22 23 elif secondNumber< thirdNumber: 24 if secondNumber< firstNumber: smallest = secondNumber 25 56 a number please?") a number please?") 26 else: 27 28 29 # Output largest and smallest number. 30 print("The largest value is " + str(largest)) 31 print("The smallest value is " + str(smallest)) 32 smallest = thirdNumber
Understanding if else Statements in Python
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
Transcribed Image Text:Understanding if else Statements in Python 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

im needing to know where the "if else" statements need to go and hard coded calculation is

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT