Recent questions tagged goclasses-da-dpp-day-193

1 1 vote
1 1 answer
113
113 views
Consider the following Python code:def evaluate(x): try: if x == 0: return "zero" return "value" finally: x += 1 if x == 1: return "changed" print(evaluate(0), evaluate(2...
1 1 vote
1 1 answer
91
91 views
Consider the following Python code:def make_funcs(): funcs = [] total = 0 for i in range(3): def add(x, step=i): nonlocal total total += x + step return total funcs.appen...
1 1 vote
1 1 answer
88
88 views
Consider the following Python code:class Counter: count = [] def __init__(self, value): self.value = value def add(self): self.count.append(self.value) self.value += 1 re...
0 0 votes
1 1 answer
87
87 views
Consider the following Python code:nums = [1, 2, 3] it = iter(nums) first = next(it) nums.append(4) second = list(it) nums.append(5) third = list(it) print(first, second,...
0 0 votes
1 1 answer
97
97 views
Consider the following Python code:data = {"a": , "b": } x = data.setdefault("c", data["a"]) x.append(3) data["a"].append(4) data["b"] = data["a"][:] data["b"].append(5...
To see more, click for the full list of questions or popular tags.