
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find Largest Number in a List using Python
In this article, we will learn about the solution and approach to solve the given problem statement.
Problem statement
Given list input, we need to find the largest numbers in the given list .
Here we will discuss two approaches
- Using sorting techniques
- Using built-in max() function
Approach 1 − Using built-in sort() function
Example
list1 = [18, 65, 78, 89, 90] list1.sort() # main print("Largest element is:", list1[-1])
Output
Largest element is: 90
Approach 2 − Using built-in max() function
Example
list1 = [18, 65, 78, 89, 90] # main print("Largest element is:",max(list1))
Output
Largest element is: 90
Conclusion
In this article, we learnt about the approach to find largest number in a list.
Advertisements