+ 1

(python) Can a set be a key in a dictionary?

Is a set mutable? I didn't find anyway to do so. Then why it can't be a key in a dictionary? https://code.sololearn.com/co4pcIF5U4RQ/?ref=app

9th Jan 2022, 6:41 AM
Lea
Lea - avatar
3 Respostas
+ 4
First : u forgot to put comma "," between dictionary elements so u should put , after the value of the first key which equals to 2 Second: 👇 https://stackoverflow.com/questions/28566797/is-it-safe-to-use-frozen-set-as-dict-key https://iq-faq.com/en/Q%26A/page=8a13e254ced3fee641e3aeccc4c9a15c
9th Jan 2022, 7:00 AM
Muhammad Galhoum
Muhammad Galhoum - avatar
+ 3
Muhammad Thank you!
11th Jan 2022, 12:38 PM
Lea
Lea - avatar
+ 1
You're welcome ☺️ Lea
11th Jan 2022, 12:41 PM
Muhammad Galhoum
Muhammad Galhoum - avatar