Hello everybody, welcome back to programminginpython.com. Here in this post, I am going to discuss a Python program that finds out the smallest and largest number on the list.
Here we use 2 predefined functions min() and max() which check for the smallest and largest number in a list respectively.
Master the basics of data analysis in Python. Expand your skillset by learning scientific computing with numpy.
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 :", min(lst))
That is for the post, here I have found the largest and the smallest element in a given list, using max() and min() built-in functions of the list which give us the maximum and minimum element from a given list.