Home » Find Largest and Smallest Item in a Tuple in python

Find Largest and Smallest Item in a Tuple in python

In this example we use the min and max functions which will return the smallest and largest items ina  tuple

Example

# Largest and Smallest Item in a tuple
number_tuple = (12, 47, 44, 9, 74, 68, 21, 32, 53, 19)
print("Tuple Items = ", number_tuple)

print("Largest  Item in the Tuple is ", max(number_tuple))
print("Smallest Item in the Tuple is ", min(number_tuple))

When you run this you will see something like this

>>> %Run maxmintuple.py
Tuple Items =  (12, 47, 44, 9, 74, 68, 21, 32, 53, 19)
Largest  Item in the Tuple is  74
Smallest Item in the Tuple is  9

You may also like

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More