+ 1
What is a Key?
whats is the difference between a key and a string ? Please provide me with a definition of each.
6 Answers
+ 7
key opens doors. string holds key so you don't lose it.
+ 5
A string is a set of characters. It can be used as a key. A key is a way of labelling and selecting a value in a dictionary, so you can retrieve it by that name rather than an index value.
+ 1
the key is an identifier for your data un the dict. the key is generaly a string (ie a simple word) or can be an int or an object too.
in a list, you access the data by an index, un a dict, you access by the key
+ 1
A String is a set of values (int, char , whatever...) with an index work as pointer and start from 0 pointing to the first element and continue till the last one.
A Dictionary is a new style of a string with a chance to rename the index by values (int, char , whatever...) and called key, and giving you more option in the value portion that you can use even a string.
0
A key is a python object ( str, int...) it must be immutable (can't be changed).
in dictionary, we associate keys to values (values are python objects but here the immutability is not a requirement ) so we access those values using the keys associated to them
0
the Bird IS a key