1class LockPicker_8MI0600296:
2
3 def __init__(self, lock):
4 self.lock = lock
5
6 def unlock(self):
7 args = []
8 outcome = False
9 while not outcome:
10 try:
11 self.lock.pick(*args)
12 except TypeError as e:
13 if not e.position:
14 args_count = e.expected
15 args = [0 for _ in range(args_count)]
16 else:
17 wrong_arg_pos = e.position
18 expected_type = e.expected
19 args[wrong_arg_pos - 1] = expected_type()
20 except ValueError as e:
21 wrong_arg_pos = e.position
22 expected_val = e.expected
23 args[wrong_arg_pos - 1] = expected_val
24 else:
25 outcome = True
Резултат от контролното:
19/25 верни отговора.
16 точки.
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
13.11.2024 19:04
13.11.2024 19:05