Nov-19-2020, 04:56 PM
(Nov-19-2020, 04:39 PM)bowlofred Wrote: Keys in a dictionary are unique, but the starting values you have are not unique. So simply reversing the order of values and keys gives a key collision. What do you think should be the answer in your final dictionary if you asked it for the key 3?inverse_dict[3] == ?
If you didn't want to lose data, you could make the value a container, like a set or a list and append any conflicts together.
Thanks for your quick reply.
You are right, I got the exercise wrong. It involves making a list. Ill give it a go now.
Thanks again!