- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Find the Largest Among Three Numbers using Python?
You can create a list of the three numbers and call the max method to find the largest among them.
example
my_list = [10, 12, 3] print(max(my_list))
Output
This will give the output −
12
Example
If you want to calculate it yourself, you can create a simple function like
def max_of_three(a, b, c): if a > b and a > c: return a elif b > c: return b else: return c print(max_of_three(10, 12, 3))
Output
This will give the output −
12
Advertisements