(Latest Update )
Introduction to Programming in
Python | Questions and Answers |
Grade A | 100% Correct - WGU
Question:
set
Answer:
an unordered collection of unique elements
Question:
set literal
Answer:
written using curly braces { } with comma separating set elements
,Question:
len(set)
Answer:
Find the length (number of elements) of the set.
Question:
set1.update(set2)
Answer:
Adds the elements in set2 to set1.
Question:
set.add(value)
Answer:
Adds value into the set.
Question:
set.remove(value)
Answer:
Removes value from the set. Raises KeyError if value is not found.
,Question:
set.pop()
Answer:
Removes a random element from the set.
Question:
set.clear()
Answer:
Removes all the elements from the set
Question:
set.intersection(set_a, set_b, set_c...)
Answer:
Returns a new set containing only the elements in common between set and
all provided sets.
Question:
set.union(set_a, set_b, set_c...)
Answer:
Returns a new set containing all of the unique elements in all sets.
, Question:
set.difference(set_a, set_b, set_c...)
Answer:
Returns a set containing only the elements of set that are not found in any of
the provided sets.
Question:
set_a.symmetric_difference(set_b)
Answer:
Returns a set containing only elements that appear in exactly one of set_a or
set_b
Question:
dictionary
Answer:
a Python container used to describe associative relationships
Question:
key
Answer:
a term that can be located in a dictionary