WordGarden.io
Back to search

tuple

C2

Pronunciation

UK

  • /ˈtjuːpəl/noun
  • /ˈtʊpəl/noun
  • /ˈtʌpəl/noun
  • /ˈt͡ʃuːpəl/noun

US

  • /ˈtuːpəl/
  • /ˈtʌpəl/

Description

Imagine you're packing for a trip. You might make a mental list: socks, toothbrush, book. That ordered sequence—socks first, then toothbrush, then book—is similar to what programmers call a "tuple." A tuple is simply an ordered collection of items. Unlike a regular list, which can change, once you create a tuple, it stays fixed!

Think of it like coordinates on a map (latitude, longitude). The order matters! (34.0522, -118.2437) tells you the location of Los Angeles, but switching those numbers wouldn't get you there. Tuples are used in computer science to group related data together—maybe a person's name and age, or the RGB values of a color. They're like sturdy little containers for keeping things organized and making sure they aren't accidentally changed.

Examples

  1. 1

    Programming return

    In Python, the function returns a tuple with the file name and its size.

    • Domain

      in programming, a tuple is a small fixed set of values

  2. 2

    Map coordinates

    Each point on the map is stored as a three-number tuple.

  3. 3

    Variable unpacking

    We unpacked the tuple into separate variables before using the values.

Forms and spellings

1 form open this card.

Main spelling

  • tuple