-
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
-
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
-
Can a value appear more than once in a set?
no
-
What is the union of the sets A and B?
a new set consisting of all the elements in A and all the elements in B
-
If we have the sets A and B with the elements below, what are the elements
formed by the union of A and B?
A = {1, 2, 3}
B = {3, 4, 5}
{1, 2, 3, 4, 5}
-
Write a Python statement to create the set s2 containing the values
1, 2 and 3, using a set literal.
s2 = {1, 2, 3}
-
If the variable s1 pointed to an empty set,
what would you see if you printed this variable?
set()