Input a list of numbers and find the smallest and largest number from the list Python Program

 

#create empty list 

mylist = []

number = int(input('How many elements to put in List: '))

for n in range(number):

    element = int(input('Enter element '))

    mylist.append(element)

print("Maximum element in the list is :", max(mylist))

print("Minimum element in the list is :", min(mylist))

Output:

 

How many elements to put in List: 5
Enter element 34
Enter element 23
Enter element 55
Enter element 11
Enter element 99
('Maximum element in the list is :', 99)
('Minimum element in the list is :', 11)
>>>

 

You may also Check :

By cbsepython

A complete solution for the students of class 9 to 12 having subject Information Technology (402), Computer Science (083). Explore our website for all the useful content as Topic wise notes, Solved QNA, MCQs, Projects and Quiz related to the latest syllabus.

Copywrite © 2020-2024, CBSE Python,
All Rights Reserved