top of page

Python Program to find largest element from the list which provided by user


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



131 views0 comments

Recent Posts

See All

Python program to calculate the factorial of a number

Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument. This program is most for O Level Practical Exam so read it care

NumPy program to find the most frequent value in the list.

This program is most for O Level Practical Exam so read it carefully. Program: import numpy as np x = np.array([1,2,3,4,5,7,2,1,1,1,8,9,1]) print(x) print("most frequent value in the list:") print(np.

Comments


bottom of page