Trusted answers to developer questions

Definition: Tuples

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

A tuple is a finite ordered list (sequence) of elements. It consists of immutable objects (objects that cannot change after creation).

Mathematicians usually write ‘tuples’ by listing the elements within parentheses and separated by commas; for example, (2,7,4,1,7)(2, 7, 4, 1, 7) denotes a 5-tuple.

A tuple is stored in a single block of memory.

A tuple containing a student's information.
A tuple containing a student's information.

Tuples are useful for representing what other languages often call records, or some related information that belongs together, like your student record. There is no description of what each element means, but we can guess quite easily because they will be related to each other.

A tuple lets us “chunk” related information together and use it as a single, unchangeable thing.


RELATED TAGS

tuples
data structure
basics
jargon
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?