10. Which of the following statements about python dictionary is correct?
A. You can have different types of data as keys in a
dictionary.
B. You can have variables as keys in a dictionary.
C. The values (key-value pairs) in a dictionary must be the types
of int or float.
D. You cannot have a list as key in a dictionary.
Statements about python dictionary:-
A. You can have different types of data as keys in a dictionary.
Answer: - Incorrect
Explanation:- Keys are unique and keys must be of an immutable data type.
B) You can have variables as keys in a dictionary.
Answer:- Correct
Explanation:- Yes we can deal with variables as keys in a dictionary.
C.) The values (key-value pairs) in a dictionary must be the types of int or float.
Answer:- Incorrect
Explanation:- You can use other datatypes as well like string,boolean etc.
D.) You cannot have a list as key in a dictionary.
Answer:- Correct
Explanation:- list should not be used as a dictionary key.
Please hit that like or thumbs-up button it really motivates me> (Hope you will do that?)>3
Thank you!!
Get Answers For Free
Most questions answered within 1 hours.