Davide Apolloni
Davide Apolloni

#Test case for the algorithm def test_fib(n, expected): result = fib(n) if expected == result: return True else: return False #Code of the algorithm def fib(n): if n
set_hobbits = set({"Frodo", "Sam", "Pippin", "Merry"}) set_magicians = set({"Saruman", "Gandalf"}) middle_earth = dict() middle_earth["hobbits"] = set_hobbits middle_earth["magicians"] = set_magicians print(middle_earth)
#Test case for the algorithm def test_expontentiation(n, exponent, expected) result = exponentiation(n, exponent) if expected == result return True else return False #Code of the algorithm def exponentation(n, e): if...

my_set=({"Bilbo", "Frodo", "Sam", "Pippin", "Merry"}) my_set.remove("Bilbo") _#"Bilbo" wears the one ring and disappears from the set_ **output**: my_set({"Frodo", "Sam", "Pippin", "Merry"}) my_set.add("Galadriel") _#"Galadriel" joins the set while she is looking...

"spam" not in "spa span sparql" and not ("egg" > "span") "spam" not in "spa span sparql" --> true ("egg" > "span") --> false true and not (false) true and...
my_queue=deque(["Draco", "Harry", "Hermione", "Ron", "Severus"]) my_queue.popleft() my_queue=deque(["Harry", "Hermione", "Ron", "Severus"]) my_queue.append("Voldemort") my_queue=deque(["Harry", "Hermione", "Ron", "Severus", "Voldemort"]) my_queue.popleft() my_queue=deque(["Hermione", "Ron", "Severus", "Voldemort"])
 Output: ['Draco', 'Harry', 'Hermione', 'Ron', 'Severus']