Python Program - Find the Largest Among Three Numbers
https:/.www/theitroad.com
Here's a program that finds the largest of three numbers in Python:
num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) num3 = float(input("Enter third number: ")) if (num1 >= num2) and (num1 >= num3): largest = num1 elif (num2 >= num1) and (num2 >= num3): largest = num2 else: largest = num3 print("The largest number is", largest)
In this program, the user is prompted to enter three numbers. The float
function is used to convert the input values to floating-point numbers. Then, the program uses a series of if
statements to compare the values and find the largest one. Finally, the program prints the largest value to the console.
When you run this program, it will prompt you to enter three numbers. After you enter the numbers and press Enter, the program will find the largest value and print it to the console.