Feb-08-2020, 04:25 AM
(This post was last modified: Feb-08-2020, 04:25 AM by new_to_python.)
(Feb-08-2020, 03:07 AM)stullis Wrote: The key here is mutability. Tuples are immutable - they cannot be changed. As such, they are hashable and can be used as elements of a set. Conversely, lists are mutable and cannot be used as set elements.
my_set[2] raises an error because the set has only one element. That element, the tuple, has four elements of its own.
Thanks. In this case, how do I access individual element(s) in the tuple which is the only element in the dict? As far as I know, there is no ordering among the elements in a set.