Back to Lesson

Rapid Mutability Protections

Lock data using frozenset constructs.

Instructions

  • Given lists
    l1 = [1, 2, 3]
    and
    l2 = [3, 4, 5]
    .
  • Create a dictionary
    metrics = {}
    .
  • Initialize a
    frozenset
    from
    l1
    as a key mapped to the string
    "V1"
    . Initialize another
    frozenset
    from
    l2
    mapped to
    "V2"
    .
  • Print
    metrics[frozenset([1, 2, 3])]
    .
main.py
main.py