1class LockPicker_4MI0600392:
 2    def __init__(self, lock):
 3        self.lock = lock
 4
 5    def unlock(self):
 6        args = []
 7        while True:
 8            try:
 9                self.lock.pick(*args) #Костадин Русалов е гей!(няма да го махна, много е смешно)
10                return  
11            except TypeError as ex:
12                if ex.position is None:
13                    args = [None] * ex.expected
14                else:
15                    expected_type = ex.expected
16                    args[ex.position - 1] = expected_type()
17            except ValueError as ex:
18                args[ex.position - 1] = ex.expected
Резултат от контролното:
    13/25 верни отговора.
    11 точки.
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
| f | 1 | class LockPicker_4MI0600392: | f | 1 | class LockPicker_4MI0600392: | 
| 2 | def __init__(self, lock): | 2 | def __init__(self, lock): | ||
| 3 | self.lock = lock | 3 | self.lock = lock | ||
| n | 4 | n | 4 | ||
| 5 | def unlock(self): | 5 | def unlock(self): | ||
| 6 | args = [] | 6 | args = [] | ||
| 7 | while True: | 7 | while True: | ||
| 8 | try: | 8 | try: | ||
| n | 9 | self.lock.pick(*args) #Костадин Русалов е гей! | n | 9 | self.lock.pick(*args) #Костадин Русалов е гей!(няма да го махна, много е смешно) | 
| 10 | return | 10 | return | ||
| 11 | except TypeError as ex: | 11 | except TypeError as ex: | ||
| 12 | if ex.position is None: | 12 | if ex.position is None: | ||
| 13 | args = [None] * ex.expected | 13 | args = [None] * ex.expected | ||
| 14 | else: | 14 | else: | ||
| t | 15 | expected_type = ex.expected | t | 15 | expected_type = ex.expected | 
| 16 | try: | ||||
| 17 | args[ex.position - 1] = expected_type | ||||
| 18 | except TypeError: | ||||
| 19 | args[ex.position - 1] = expected_type() | 16 | args[ex.position - 1] = expected_type() | ||
| 20 | except ValueError as ex: | 17 | except ValueError as ex: | ||
| 21 | args[ex.position - 1] = ex.expected | 18 | args[ex.position - 1] = ex.expected | 
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 
 | 
 | |||||||||
| f | 1 | class LockPicker_4MI0600392: | f | 1 | class LockPicker_4MI0600392: | 
| 2 | def __init__(self, lock): | 2 | def __init__(self, lock): | ||
| 3 | self.lock = lock | 3 | self.lock = lock | ||
| 4 | 4 | ||||
| 5 | def unlock(self): | 5 | def unlock(self): | ||
| 6 | args = [] | 6 | args = [] | ||
| 7 | while True: | 7 | while True: | ||
| 8 | try: | 8 | try: | ||
| 9 | self.lock.pick(*args) #Костадин Русалов е гей! | 9 | self.lock.pick(*args) #Костадин Русалов е гей! | ||
| 10 | return | 10 | return | ||
| 11 | except TypeError as ex: | 11 | except TypeError as ex: | ||
| 12 | if ex.position is None: | 12 | if ex.position is None: | ||
| 13 | args = [None] * ex.expected | 13 | args = [None] * ex.expected | ||
| 14 | else: | 14 | else: | ||
| 15 | expected_type = ex.expected | 15 | expected_type = ex.expected | ||
| 16 | try: | 16 | try: | ||
| 17 | args[ex.position - 1] = expected_type | 17 | args[ex.position - 1] = expected_type | ||
| 18 | except TypeError: | 18 | except TypeError: | ||
| 19 | args[ex.position - 1] = expected_type() | 19 | args[ex.position - 1] = expected_type() | ||
| 20 | except ValueError as ex: | 20 | except ValueError as ex: | ||
| 21 | args[ex.position - 1] = ex.expected | 21 | args[ex.position - 1] = ex.expected | ||
| t | 22 | t | |||
| 23 | |||||
| 24 | |||||
| 25 | |||||
| 26 | |||||
| 27 | |||||
| 28 | 
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 
 | 
 | |||||||||