Easy Tutorial
❮ Python Os Replace Python Func Number Acos ❯

Python Finding the Smallest Element in a List

Python3 Examples

Define a list of numbers and find the smallest element in the list.

For example:

Input : list1 = [10, 20, 4]
Output : 4

Example 1

list1 = [10, 20, 4, 45, 99] 
  
list1.sort() 
  
print("Smallest element is:", *list1[:1])

The output of the above example is:

Smallest element is: 4

Example 2: Using the min() Method

list1 = [10, 20, 1, 45, 99] 
  
print("Smallest element is:", min(list1))

The output of the above example is:

Smallest element is: 1

Python3 Examples

❮ Python Os Replace Python Func Number Acos ❯