BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Python Program to Find Largest among Three Numbers

Last Updated: June 8, 2019 by Chaitanya Singh | Filed Under: Python Examples

In this article, we will write a python program to find the largest number among the three input numbers. To understand the following program, you should have the knowledge of following python concepts:

  1. Python if..elif..else statement
  2. How to take input from user in Python

python program to find the largest number among the three input numbers

In the following python program, we are taking input from the user. User enters three numbers and program finds the largest among three numbers using if..elif..else statement. Here we are using float() function while taking input from the user so that we can accept the numbers in float values as well.

# Python program to find the largest among three numbers

# taking input from user
num1 = float(input("Enter 1st number: "))
num2 = float(input("Enter 2nd number: "))
num3 = float(input("Enter 3rd number: "))

if (num1 >= num2) and (num1 >= num3):
   lnum = num1
elif (num2 >= num1) and (num2 >= num3):
   lnum = num2
else:
   lnum = num3

print("The largest number among",num1,",",num2,"and",num3,"is: ",lnum)

Output:
Python Program to Find Largest among Three Numbers

Related Python examples:

  1. Python program to convert Celsius to Fahrenheit
  2. Python program to find sum of n natural numbers
  3. Python program to add digits of a number
  4. Python program to add subtract multiply and divide two numbers
  5. Python program to swap two numbers

Top Related Articles:

  1. Python Program to Convert Celsius To Fahrenheit and Vice Versa
  2. Python Program to Print Calendar
  3. Python Program to Convert Decimal to Hexadecimal
  4. Python Program to Check if a Number is Positive Negative or Zero
  5. Getting Input from User in Python

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap