diff --git a/native-datatypes.html b/native-datatypes.html index e09a740..b746cef 100755 --- a/native-datatypes.html +++ b/native-datatypes.html @@ -634,7 +634,7 @@ AttributeError: 'tuple' object has no attribute 'remove'
  • The update() method takes one argument, a set, and adds all its members to the original set. It’s as if you called the add() method with each member of the set.
  • Duplicate values are ignored, since sets can not contain duplicates.
  • You can actually call the update() method with any number of arguments. When called with two sets, the update() method adds all the members of each set to the original set (dropping duplicates). -
  • The update() method can take a number of different datatypes, including lists. When called with a list, the update() method adds all the items of the list to the original set. +
  • The update() method can take objects of a number of different datatypes, including lists. When called with a list, the update() method adds all the items of the list to the original set.

    Removing Items From A Set

    @@ -685,7 +685,7 @@ KeyError: 21 File "<stdin>", line 1, in <module> KeyError: 'pop from an empty set'
      -
    1. The pop() method removes a single value from a set a returns the value. However, since sets are unordered, there is no “last” value in a set, so there is no way to control which value gets removed. It is essentially random. +
    2. The pop() method removes a single value from a set and returns the value. However, since sets are unordered, there is no “last” value in a set, so there is no way to control which value gets removed. It is essentially random.
    3. The clear() method removes all values from a set, leaving you with an empty set. This is equivalent to a_set = set(), which would create a new empty set and overwrite the previous value of the a_set variable.
    4. Attempting to pop a value from an empty set will raise a KeyError exception.
    @@ -710,7 +710,7 @@ KeyError: 'pop from an empty set' >>> a_set.symmetric_difference(b_set) {1, 3, 4, 6, 8, 76, 15, 17, 18, 195, 127, 30, 51}
      -
    1. To test whether a value in a member of a set, use the in operator. This works the same as lists. +
    2. To test whether a value is a member of a set, use the in operator. This works the same as lists.
    3. The union() method returns a new set containing all the elements that are in either set.
    4. The intersection() method returns a new set containing all the elements that are in both sets.
    5. The difference() method returns a new set containing all the elements that are in a_set but not b_set.