Computer Science, asked by sanhitabhowmik2004, 6 months ago

write a short program in python to find the largest number of a list of numbers entered through keyboard​

Answers

Answered by rushi7962
6

Answer:

Python program to find largest number in a list

Given a list of numbers, the task is to write a Python program to find the largest number in given list.

Examples:

Input : list1 = [10, 20, 4] Output : 20 Input : list2 = [20, 10, 20, 4, 100] Output : 100

Method 1 : Sort the list in ascending order and print the last element in the list.

# Python program to find largest

# number in a list

  

# list of numbers

list1 = [10, 20, 4, 45, 99]

  

# sorting the list

list1.sort()

  

# printing the last element

print("Largest element is:", list1[-1])

Output:

Largest element is: 99

Answered by dishanikar16
13

Answer:

lst = []

num = int(input('How many numbers: '))

for n in range(num):

numbers = int(input('Enter number '))

lst.append(numbers)

print("Maximum element in the list is :", max(lst), "\nMinimum element in the list is :

Explanation:

Read input number asking for length of the list using input() or raw_input().

Initialise an empty list lst = [].

Read each number using a for loop.

In the for loop append each number to the list.

Now we use predefined function max() to find the largest element in a list.

Similarly we use another predefined function min() to find the smallest element in a list.

plz follow me ....and Mark me as brainliest

Similar questions