# Support Our Site

To ensure we can continue delivering content and maintaining a free platform for all users, we kindly request that you disable your adblocker. Your contribution greatly supports our site's growth and development.

# Python Program to Find the Largest Among Three Numbers

## Problem Definition

Create a Python program to find the largest among the three given numbers.

In this article, we will show you two methods to address this same problem one being the conventional way and the other being the Pythonic way.

## Find The Largest Number Using Conditional Statements

1. Take inputs from the user and store them in variables
2. Compare the numbers
3. Print the final result
4. End

To understand the program you need to have an understanding of following Python concept.

``````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 = num1elif (num2 > num1) and (num2 > num3):
largest = num2else:
largest = num3print("The largest number is",largest)``````

## Runtime Test Cases

``````Enter first number: 1
Enter second number: 2
Enter third number: 3
The largest number is 3.0``````

## Find The Largest Number Using List Function

``````num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))

my_list = [num1, num2, num3]
Largest = max(my_list)
print("The Largest number is", Largest)``````

## Runtime Test Cases

``````Enter first number: 1
Enter second number: 2
Enter third number: 3
The largest number is 3.0``````

In this approach, we are making a list of all the inputs and using the `max()` method which returns the item with the highest value in the list.

PROGRAMS

# Latest Articles

Latest from djangocentral

## How to Use Subquery() in Django With Practical Examples

In the realm of web development, Django stands as a powerful and versatile framework for building robust applications. One of the key aspects of developing efficient and optimized web applications is handling database queries effectively. In this article…

## DRF Serializer: Handling OrderedDict and Converting It to a Dictionary or JSON

In Django Rest Framework (DRF) tests, when you access serializer.data, you might encounter an OrderedDict instead of a regular dictionary. This behavior is intentional and reflects the design of DRF's serialization process.Understanding the Problem The u…

## Django Rest Framework CheetSheet: Mastering API Development

Django Rest Framework (DRF) is a powerful toolkit that makes building robust and scalable web APIs with Django a breeze. Whether you're a seasoned Django developer or a newcomer, having a comprehensive cheat sheet at your disposal can be a game-changer. …