Exercise
Largest Among Three Values
Objective
Develop a Python program that asks the user to input three numbers and then displays the largest one.
Example Python Exercise
Show Python Code
# Prompt the user to enter the first number
num1 = float(input("Please enter the first number: "))
# Prompt the user to enter the second number
num2 = float(input("Please enter the second number: "))
# Prompt the user to enter the third number
num3 = float(input("Please enter the third number: "))
# Determine the largest number and display the result
largest = max(num1, num2, num3)
print(f"The largest number among {num1}, {num2}, and {num3} is {largest}")
Output
Please enter the first number: 5
Please enter the second number: 8
Please enter the third number: 3
The largest number among 5.0, 8.0, and 3.0 is 8.0
Share this Python Exercise
Explore our set of Python Programming Exercises! Specifically designed for beginners, these exercises will help you develop a solid understanding of the basics of Python. From variables and data types to control structures and simple functions, each exercise is crafted to challenge you incrementally as you build confidence in coding in Python.
In this exercise, you will develop a Python program that prompts the user for a number "x" and calculates the result of 10 * x. The program will display...
In this exercise, you will develop a Python program that prompts the user for a number "x" and displays 10*x. This exercise is perfect for practicing user inpu...
In this exercise, you will develop a Python program that displays the numbers from 1 to 10 on the screen using a while loop. This task emphasizes the us...
In this exercise, you will develop a Python program that prompts the user to input a number and then displays its multiplication table using a while ...
In this exercise, you will develop a Python program that displays the odd numbers from 15 to 7 in descending order using a while loop. This task ...
In this exercise, you will develop a Python program that prompts the user for an undetermined amount of numbers until the user enters 0. The program wil...