Ask your own question, for FREE!
Computer Science 17 Online
kekeman:

Select the true statement regarding Python dictionaries. Keys in dictionaries are mutable. Keys in dictionaries can be changed. Values in dictionaries can be changed. Values in dictionaries cannot be of any type.

kekeman:

I think the answer is C.)

Alexis1415:

I found this very helpful educational website that informed me: "Almost any type of value can be used as a dictionary key in Python. You can even use built-in objects like types and functions. However, there are a couple restrictions that dictionary keys must abide by. First, a given key can appear in a dictionary only once. Duplicate keys are not allowed. A dictionary maps each key to a corresponding value, so it doesn’t make sense to map a particular key more than once. If you specify a key a second time during the initial creation of a dictionary, then the second occurrence will override the first. Second, a dictionary key must be of a type that is immutable. 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." A, It cannot be A because, in the paragraph that says "Second" it states: a dictionary key must be of a type that is immutable. So it cannot be A. B. It cannot be B because, In the paragraph that says "First" It says: a given key can appear in a dictionary only once. then the second occurrence will override the first. So it cannot be B. C, Is correct because the values in dictionaries can be changed by anyone. D, cannot be correct because it would make no sense to make a dictionary and make the values non changeable by anyone who purchases. Credit goes to ~Real Python Link to source: https://realpython.com/lessons/restrictions-dictionary-keys-and-values/

Alexis1415:

So @kekeman You would be correct!

kekeman:

Okay thank you!!

Tonycoolkid21:

@badboy1557

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!