Python TutorialLesson 15Free preview
Python Tuples
This lesson is part of Python · All levels
Summary
The tuple is similar to a list but is immutable, meaning that its contents cannot be changed once the tuple is made. Tuples are written with ordinary curves and are often used for data that must be fixed such as coordinate pairs or log notes. Because it's unchanged, the tuple is a little more memory-efficient and safe to use as a dictionary key.
Key points
- Tuple is written in ordinary curves () and separated by commas.
- The tuple is immutable so additions or alterations to the element are not allowed.
- Tuple can open up the contents into some variables through unpacking.
- Tuples can be converted to lists with the function list() if needed.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.