Last updated on February 8th, 2022 at 11:26 am
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 :
Find the largest/smallest number in a list/tuple
Input a list of numbers and swap elements at the even location with the elements at the odd location.
Input a list/tuple of elements, search for a given element in the list/tuple.
Create a dictionary with the roll number, name and marks of n students in a class and display the names of students who have scored marks above 75.