| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 def redundant_parenthesis(x, y, z): | 1 def redundant_parenthesis(x, y, z): |
| 2 # * A111 | 2 # * A111 |
| 3 while (x): | 3 while (x): |
| 4 # * A111 | 4 # * A111 |
| 5 if ((x or y) and z): | 5 if ((x or y) and z): |
| 6 pass | 6 pass |
| 7 # * A111 | 7 # * A111 |
| 8 elif (x == max(y, z)): | 8 elif (x == max(y, z)): |
| 9 pass | 9 pass |
| 10 else: | 10 else: |
| 11 return | 11 return |
| 12 | 12 |
| 13 # * A111 | 13 # * A111 |
| 14 for (a, b, c) in y: | 14 for (a, b, c) in y: |
| 15 # * A111 | 15 # * A111 |
|
tlucas
2017/11/15 09:06:17
If i'm not mistaken, the *'s column should match t
rosie
2017/12/07 01:51:26
Done.
| |
| 16 result = (a + b + c) | 16 result = (a + b + c) |
| 17 # * A111 | 17 # * A111 |
| 18 return result or ('foo') | 18 return result or ('foo') |
| 19 | 19 |
| 20 # A111 | 20 # A111 |
| 21 (a, b, c) = x | 21 (a, b, c) = x |
| 22 del a, b, c | 22 del a, b, c |
| 23 | 23 |
| 24 | 24 |
| 25 def mandatory_parenthesis(x, y, z): | 25 def mandatory_parenthesis(x, y, z): |
| 26 if (): | 26 if (): |
| 27 return | 27 return |
| 28 if (x, y, z): | 28 if (x, y, z): |
| 29 return | 29 return |
| 30 | 30 |
| 31 if (x or y) and z: | 31 if (x or y) and z: |
| 32 return | 32 return |
| 33 if x and (y or z): | 33 if x and (y or z): |
| 34 return | 34 return |
| 35 | 35 |
| 36 if (x or | 36 if (x or |
| 37 y): | 37 y): |
| 38 return | 38 return |
| 39 | 39 |
| 40 | 40 |
| 41 def acceptable_parenthesis(x, y, z): | 41 def acceptable_parenthesis(x, y, z): |
| 42 a = (x == y) | 42 a = (x == y) |
| 43 b = (x or y == z) | 43 b = (x or y == z) |
| 44 c = (x + y) / z | 44 c = (x + y) / z |
| 45 d = (x and y) or z | 45 d = (x and y) or z |
| 46 return (a, b, c, d) | 46 return (a, b, c, d) |
| LEFT | RIGHT |