Python Program to find largest element from list:
list = []
num = int(input("Enter number of elements in list: "))
for i in range(1, num + 1):
a = int(input("Enter elements: "))
list.append(a)
print("Largest element is:", max(list))
Output:
Enter number of elements in list: 3
Enter elements: 19
Enter elements: 13
Enter elements: 88
Largest element is: 88
Python Program to find largest elements in given list:
list = [1, 2, 40, 45,70]
print("Largest element is:", max(list))
Output:
Largest element is: 70
To find the largest number in a list through Function
def maxele(list):
print(max(list))
list = [30, 60, 70, 4, 180]
maxele(list)
Output:
180
Comments