Sara
Sara
set_hobbit = ({"Frodo", "Sam", "Pippin", "Merry"}) set_magician = ({"Saruman", "Gandalf"}) my_first_dictionary = dict() my_first_dictionary["hobbit"] = set_hobbit my_first_dictionary["magician"] = set_magician print(my_first_dictionary) output: {'hobbit': {'Sam', 'Pippin', 'Frodo', 'Merry'}, 'magician': {'Gandalf', 'Saruman'}}
Considering the first exercise: the_hobbits = set() the_hobbits.add("Bilbo") the_hobbits.add("Frodo") the_hobbits.add("Sam") the_hobbits.add("Pippin") the_hobbits.add("Merry") print(the_hobbits) _exercise 2:_ my_set.remove("Bilbo"), my_set.add("Galadriel"), my_set.update(set({"Saruman", "Frodo", "Gandalf"})). **the_hobbits.remove("Bilbo")** # this removes "Bilbo" from the set # the_hobbits...
the_hobbits = set() _# this creates a new set_ _# adding elements to the set without any particular order_ the_hobbits.add("Bilbo") the_hobbits.add("Frodo") the_hobbits.add("Sam") the_hobbits.add("Pippin") the_hobbits.add("Merry") print(the_hobbits) Output: the_hobbits{'Sam', 'Frodo', 'Bilbo', 'Merry',...
"spam" not in "spa span sparql" and not ("egg" > "span") "spam" not in "spa span sparql" = **_True_** not ("egg" > "span") = **_not (False)_** True and not (False)...
not (not True or False and True) or False not (**_False_** or False and True) or False not (**_False_** or False) or False not (**_False_**) or False **_True_** or False...