Python 3 Program to Find Largest Among Three Numbers

0
304

In this program, you will find the simple Python 3 program to find the largest among the three numbers. To understand this program, you must have basic knowledge of Python programming concepts such as variables, operators, and conditional statements. Here are some recommended Python books for beginners that you can use in your Python journey.

Recent Python TutorialHow To Send Email Using Python With File Attachments.

Other Python Programs:

  1. Python 3 Program to Convert Kilometers to Miles.
  2. Python 3 Program to Generate A Random Number.
  3. Python 3 Program To Swap Two Numbers.
  4. Python 3 Program To Solve A Quadratic Equation.
  5. Python 3 Program to Calculate The Area of a Triangle.

Python 3 Program To Find The Largest Among Three Numbers

Take three numbers of input from the user using the input function. After that, you can use if – elif statements to compare three numbers and print the largest among the three numbers.

Source Code

num1 = float(input("enter 1st number: "))
num2 = float(input("enter 2nd number: "))
num3 = float(input("enter 3rd number: "))

if (num1 > num2) and (num1 > num3):
   largest_num = num1
elif (num2 > num1) and (num2 > num3):
   largest_num = num2
else:
   largest_num = num3
print("the largest number= ", largest_num)

Run The Program

Output

python output - largest among three numbers

Download Source Code.

Other Python Programs

  1. Python 3 Program to Check Leap Year.
  2. Python 3 Program to Check if a Number is Positive, Negative, or 0.
  3. Python 3 Program To Convert Celsius To Fahrenheit And Fahrenheit To Celsius.
  4. Python 3 Program To Find Largest Element In An Array or List.
  5. Python 3 Program To Find The Sum of An Array.
  6. Python 3 Program To Add Two Matrices.
  7. Python 3 Program to Check Armstrong Number.
  8. How To Make A Simple Python Calculator Using Functions.
  9. Python 3 Program to Find the Sum of Natural Numbers.
  10. Python 3 Program To Find The Factorial Of A Number.