Last Updated : 11 Jul, 2025
In this article, we will discuss various methods to find smallest number in a list. The simplest way to find the smallest number in a list is by using Python's built-in min() function.
Using min()The min() function takes an iterable (like a list, typle etc.) and returns the smallest value.
Python
a = [8, 3, 5, 1, 9, 12]
# Find the smallest number
smallest = min(a)
print(smallest)
Let us explore different methods to find smallest number in a list.
Using a For LoopWe can also find the smallest number in a list without using any built-in methods by using a loop (for loop). This method is useful for understanding how the comparison process works step by step.
Python
a = [8, 3, 5, 1, 9, 12]
# Initialize "smallest" value with first element of list
smallest = a[0]
# Iterate through list to find smallest element
for val in a:
# If current value is smaller than current smallest value
if val < smallest:
# Update the smallest value
smallest = val
print(smallest)
Using Sorting
Another way to find the smallest number in a list is by sorting it. Once sorted in ascending order, the smallest number will be at the beginning of the list.
Python
a = [8, 3, 5, 1, 9, 12]
a.sort()
smallest = a[0]
print(smallest)
Explanation:
Note: This method is not recommended for finding the smallest number in a list. While it works but it is less efficient than using min() or a for loop. Sorting has a time complexity of O(n log n), whereas the other methods are O(n).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4