-
Can the key in a dictionary entry be any data type?
no. you can only use values that are immutable, that cannot be changed
-
Can the value in a dictionary entry be any data type?
yes
-
Can the value in a dictionary entry be a list?
yes. values do not have to be immutable
-
What string value does Python think of as
False
in an if
statement?
the empty string
-
What string value does Python think of as
True
in an if
statement?
anything that is not the empty string
-
What integer value does Python think of as
True
in an if
statement?
anything other than 0
-
What integer value does Python think of as
False
in an if
statement?
only 0
-
What boolean value does Python assign to -1 in an
if
statement?
True
-
What does the clear method of a dictionary object do?
removes all the key-value pairs from a dictionary
-
What does the get method of a dictionary object do?
it retrieves a value from a dictionary, but does not raise an exception if the key given as an argument
does not exist in the dictionary