File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
exercises/practice/pythagorean-triplet/.approaches Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -146,23 +146,20 @@ Although it is important to note that this solution could have chosen a better n
146146``` python
147147def 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
You can’t perform that action at this time.
0 commit comments