## azamtoiri/ Algorithms

Re-defined variable from outer scope PYL-W0621
Anti-pattern
8 months ago8 months old
Redefining name 'holes' from outer scope (line 18)
``` 1# ASSIGN MICE TO HOLES
2
3def assign_hole(mice: list, holes: list): 4    if len(mice) != len(holes):
5        return "Number of mice and holes not the same"
6```
Redefining name 'mice' from outer scope (line 17)
``` 1# ASSIGN MICE TO HOLES
2
3def assign_hole(mice: list, holes: list): 4    if len(mice) != len(holes):
5        return "Number of mice and holes not the same"
6```
Redefining name 'y' from outer scope (line 5)
``` 5y = np.array([[2, 3], [3, 4]])
6
7
8def strassen_iter(x: list, y: list): 9    a, b, c, d, = x[0, 0,], x[0, 1], x[1, 0], x[1, 1]
10    e, f, g, h, = y[0, 0,], y[0, 1], y[1, 0], y[1, 1]
11```
Redefining name 'x' from outer scope (line 4)
``` 5y = np.array([[2, 3], [3, 4]])
6
7
8def strassen_iter(x: list, y: list): 9    a, b, c, d, = x[0, 0,], x[0, 1], x[1, 0], x[1, 1]
10    e, f, g, h, = y[0, 0,], y[0, 1], y[1, 0], y[1, 1]
11```
Redefining name 'target' from outer scope (line 12)
``` 1# Search and sort
2
3# return index position of searching element
4def simple_search(arr: list, target: int) -> int: 5    for i in range(len(arr)):
6        if arr[i] == target:
7            return i```