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 Tutorial: How To Send Email Using Python With File Attachments.
Other Python Programs:
- Python 3 Program to Convert Kilometers to Miles.
- Python 3 Program to Generate A Random Number.
- Python 3 Program To Swap Two Numbers.
- Python 3 Program To Solve A Quadratic Equation.
- 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
Other Python Programs
- Python 3 Program to Check Leap Year.
- Python 3 Program to Check if a Number is Positive, Negative, or 0.
- Python 3 Program To Convert Celsius To Fahrenheit And Fahrenheit To Celsius.
- Python 3 Program To Find Largest Element In An Array or List.
- Python 3 Program To Find The Sum of An Array.
- Python 3 Program To Add Two Matrices.
- Python 3 Program to Check Armstrong Number.
- How To Make A Simple Python Calculator Using Functions.
- Python 3 Program to Find the Sum of Natural Numbers.
- Python 3 Program To Find The Factorial Of A Number.
B.Tech from DTU. Data Science and Machine Learning enthusiasts teamed up with CodeItBro to share my knowledge and expertise.