Skip to content

Commit e81132a

Browse files
authored
PEP refactor
1 parent 01fb257 commit e81132a

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

exercises/practice/pythagorean-triplet/.approaches/introduction.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,20 @@ Although it is important to note that this solution could have chosen a better n
146146
```python
147147
def triplets_with_sum(number):
148148
def calculate_medium(small):
149-
150149
# We have two numbers, but need the third.
151150
return (number ** 2 - 2 * number * small) / (2 * (number - small))
152151

153152
two_sides = (
154-
(int(medium), small) for
155-
small in range(3, number // 3) if
156-
157-
#Calls calculate_medium and assigns return value to variable medium
158-
small < (medium := calculate_medium(small)) and
159-
medium.is_integer()
160-
)
153+
(int(medium), small) for small in range(3, number // 3) if
154+
155+
#Calls calculate_medium and assigns return value to variable medium
156+
small < (medium := calculate_medium(small)) and medium.is_integer()
157+
)
161158

162159
return [
163-
[small, medium, (medium ** 2 + small ** 2) ** 0.5]
164-
for medium, small in two_sides
165-
]
160+
[small, medium, (medium ** 2 + small ** 2) ** 0.5]
161+
for medium, small in two_sides
162+
]
166163
```
167164

168165

0 commit comments

Comments
 (0)