1class LockPicker_4MI0600290:
2 def __init__(self, lock):
3 self.lock = lock
4
5 def unlock(self):
6 args_count = self._get_args_count()
7 args = [None] * args_count
8
9 while True:
10 try:
11 self.lock.pick(*args)
12 return
13 except TypeError as exc:
14 if exc.position is not None:
15 args[exc.position - 1] = exc.expected()
16 except ValueError as exc:
17 if exc.position is not None:
18 args[exc.position - 1] = exc.expected
19
20 def _get_args_count(self):
21 try:
22 self.lock.pick()
23 except TypeError as exc:
24 if exc.position is None:
25 return exc.expected
26 return 0
Резултат от контролното:
20/25 верни отговора.
17 точки.
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK