Could we not use natural numbers as key in dictionary functions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could we not use natural numbers as key in dictionary functions?

It is written that mutable values could not be used as key in dictionary function . please do tell what are the mutable values . Is integer and alphabets included in it too?

3rd Mar 2017, 4:05 AM
prashant
prashant - avatar
4 Answers
+ 2
Yes we can
3rd Mar 2017, 5:13 AM
Leshark
Leshark - avatar
+ 1
Mutable means you can change it internally. You cannot change the number 5. It is just plain number. Nothing in there to change. Objects you create are usually mutable. You can change their contents. Hope that helps.
4th Mar 2017, 5:11 AM
1of3
1of3 - avatar
0
thanks all of you
26th Mar 2017, 6:16 AM
prashant
prashant - avatar
- 1
Yes you can consider the immutables as constants they are just what they are. But lists and variables you can change by assigning new values to them
23rd Mar 2017, 11:18 PM
SAMI Awad
SAMI Awad - avatar