Computer Science, asked by heamprakash511, 3 months ago

What type of objects can be used as keys indictionary?

Answers

Answered by Anonymous
2

Answer:

Values that are not hashable, that is, values containing lists, dictionaries or other mutable types (that are compared by value rather than by object identity) may not be used as keys. ... Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally.

For example, you can use an integer, float, string, or Boolean as a dictionary key. However, neither a list nor another dictionary can serve as a dictionary key, because lists and dictionaries are mutable. Values, on the other hand, can be any type and can be used more than once.

Explanation:

Answered by Anonymous
21

\huge{\mathbb{\red{A}\green{N}\pink{S}\orange{W}\blue{E}\pink{R:-}}}

==>>

For example, you can use an integer, float, string, or Boolean as a dictionary key. However, neither a list nor another dictionary can serve as a dictionary key, because lists and dictionaries are mutable

Similar questions