+ 1

CAN SOMEONE EMBEDDING LIST AS A VALUE INSIDE DICTIONARY KEY.

is it possible to use List as value to a dictionary key?

20th Feb 2017, 12:47 PM
Emmanuel
Emmanuel - avatar
6 odpowiedzi
+ 3
No, keys must be of hashable type...
20th Feb 2017, 12:56 PM
visph
visph - avatar
+ 2
Yes, that you can ;)
20th Feb 2017, 1:02 PM
visph
visph - avatar
+ 1
Try it: you can...
20th Feb 2017, 1:06 PM
visph
visph - avatar
0
I mean to use a list as a value to a key, eg: house{toilet:[81,30],kitchen:[50,20]. something like that.
20th Feb 2017, 1:01 PM
Emmanuel
Emmanuel - avatar
0
I have gotten the answer: as value u can use mutable elements like list and dictionary, while keys can only be immutables.
20th Feb 2017, 1:04 PM
Emmanuel
Emmanuel - avatar
0
You can use it as avalue but you cannot use it as a key.
23rd Mar 2017, 11:20 PM
SAMI Awad
SAMI Awad - avatar