Is there a way to swap key:value pairs quicker than to do so manually, similar to how we were asked in the “Invalid Keys” exercise?
I have tried the following, however, the traceback that arises due to the invalid dictionary convention in the first line prevents the programme from running to the block of code that performs the swap:
children = {["Johannes", "Rosmarie", "Eleonore"]: "von Trapp", ["Sonny", "Fredo", "Michael"]: "Corleone"}
swapped_children = {value: key for key, value in children.items()}
print(swapped_children)