Can we use keys that are not strings?


#1

Question

In the context of this exercise, can we use keys that are not strings?

Answer

Yes, you can use different data types as keys instead of strings. However, the different types of keys you can use will depend on what programming language you are using.

In languages such as Java or Python, you can use almost any type of object as your keys. These include objects like lists, instances, dictionaries, and other objects in that language. You can also use numerical values such as integers or float values, or single characters as your keys.