- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- 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

# Python program to find the largest number in a list

In this article, we will learn about the solution to the problem statement given below.

**Problem statement **− We are given a list, we need to calculate the largest element of the list.

Here we will take the help of built-in functions to reach the solution of the problem statement

## Using sort() function

### Example

# list list1 = [23,1,32,67,2,34,12] # sorting list1.sort() # printing the last element print("Largest element is:", list1[-1])

### Output

Largest in given array is 67

## Using max() function

### Example

# list list1 = [23,1,32,67,2,34,12] # printing the maximum element print("Largest element is:", max(list1))

### Output

Largest in given array is 67

We can also take input from the user by the code given below

### Example

# empty list list1 = [] # asking number of elements to put in list num = int(input("Enter number of elements in list: ")) # appending elements in the list for i in range(1, num + 1): ele = int(input("Enter elements: ")) list1.append(ele) # print maximum element print("Largest element is:", max(list1))

## Conclusion

In this article, we have learned how to get the largest element from the list.

- Related Questions & Answers
- Python program to find largest number in a list
- Python program to find the second largest number in a list
- Python Program to Find the Second Largest Number in a List Using Bubble Sort
- Python Program to Print Largest Even and Largest Odd Number in a List
- Python Program to Find the Largest Element in a Doubly Linked List
- Python program to find N largest elements from a list
- Program to find lexicographically largest mountain list in Python
- Python program to find Largest, Smallest, Second Largest, and Second Smallest in a List?
- Python program to find the smallest number in a list
- Golang Program to Print the Largest Even and Largest Odd Number in a List
- Program to find the largest grouping of anagrams from a word list in Python
- C# program to find Largest, Smallest, Second Largest, Second Smallest in a List
- Python Program for Find largest prime factor of a number
- Java program to find the largest number in an array
- Program to find largest kth index value of one list in Python

Advertisements