Tuple

noun

say it: “TOO-pul” /ˈtupəl/

A Python collection like a list that can't be changed once made, written with round brackets, used for values that belong together.

What is a tuple?

A tuple is like a list that can't be changed once it's made. It uses round brackets. Use it for values that belong together, like a point on a map.

location = (39.7392, -104.9903)   # latitude, longitude
print(location[0])  # 39.7392

In a sentence

  • “The store's location is a tuple of latitude and longitude.”
  • “A function can return a tuple such as (total, tax).”

Level: Apprentice · More Python terms at this level

Updated

In other subjects