find the largest/smallest number in a list/tuple in python
Answers
Answered by
27
Answer:
Given in image.
HOPE THAT THIS HELPS YOU.
Attachments:
Answered by
10
Python program to find the Smallest and the largest number present inside the list.
Algorithm:
- Ask for the size of the list using input( ).
- Initialize the empty list lst=[ ].
- Read numbers by using for loop.
- Each number is append( ) into the list inside the for loop.
- To find the largest and smallest element present in the list use function max( ) and min( ) respectively.
Program in python:
Numlist = [ ]
n = int(input('List Size: '))
for n in range(n):
numbers = int(input('Enter number '))
lst.append (numbers)
print( max(Numlist))
print( min(Numlist))
Similar questions
print("The list is :", val)
mx = max(val) =
mn = min(val)
print("Maximum number in the list :", mx) print("Minimum number in the list :", mn)