Which of the following data types can be used as keys in dictionaries in Python? Select all that apply
Explanation
Only so called hashable objects can be used as dictionary keys in Python. But which object is hashable then?
Many people mistakenly say that only immutable data types are hashable. But it is not entirely correct. Object is hashable if hash() function returns the same value for it throughout the program execution.
Among provided answers - String and Integer are hashable. Immutable data types are subset of all hashable types in Python.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з Python
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести