Basic Programs

If Else Programs

While loop Programs

For loop Programs

List Programs


Python Program to find Smallest Number in a List


This example shows, how to find the smallest number in a list .We are using the min method and returning the smallest element present in list.

Example.py
a = []

num = int(input("Enter number of elements in list: "))

for i in range(1, num + 1):
    ele= int(input("Enter elements: "))
    a.append(ele)
print("Smallest element is:", min(a))

Output

Enter number of elements in list: 5
Enter elements: 56
Enter elements: 96
Enter elements: 89
Enter elements: 78
Enter elements: 98
Smallest element is: 56

Prev Next