Menu Close

Find the Largest Number in a List.

Python Program to Find the Largest Number in a List.

Input :
First Line: Number Of Elements in the list

Second Line: Elements of the List

Output :
Prints the largest element of the list

N=int(input('Enter the N values: '))

l=list(map(int,input('Enter the list of numbers: ').split(' ')))
l.sort()
print('Largest Number in the list: ',l[N-1])  # or you can use max(l) instead of l[N-1].

Input_1:
Enter the N values: 3
Enter the list of numbers: 23 567 3
Output:
Largest Number in the list: 567


Input_2:
Enter the N values: 4
Enter the list of numbers: 34 56 24 54
Output:
Largest Number in the list: 56


Input_3:
Enter the N values: 5
Enter the list of numbers: 69 52 325 8541 54
Output:
Largest Number in the list: 8541


Morae Q!