Overview of Tuples and Sets
Tuples and sets, like lists, are collections of objects called iterables, which means you can use a loop to iterate through every element in it.
Tuples are immutable and ordered, but the objects inside can be mutable.
Sets are mutable and unordered, but the objects inside are immutable.
The only structural difference between a tuple and a list is that a tuple is immutable and a list is mutable. This difference creates many differences in use. For example, tuples can be used as keys in a dictionary while lists cannot.
A unique property of a set is that it can only store one of each element in no particular order and has built-in methods that allow you to perform set operations (talked about in a later section).
Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact email@example.com for inquiries.