A named tuple is a variant of a tuple whose values can be accessed by a given attribute instead of indices. For example, the following is a tuple with a person's details.
Instead of using indices in print()
, we could make the code a bit clear with a Named Tuple.