From e81132ad388df211d0894f31ee8a028d6f73ffc2 Mon Sep 17 00:00:00 2001 From: Ryan Souza <76923948+Ryrden@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:19:40 -0300 Subject: [PATCH] PEP refactor --- .../.approaches/introduction.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/exercises/practice/pythagorean-triplet/.approaches/introduction.md b/exercises/practice/pythagorean-triplet/.approaches/introduction.md index 0a8cb171416..750d52801b5 100644 --- a/exercises/practice/pythagorean-triplet/.approaches/introduction.md +++ b/exercises/practice/pythagorean-triplet/.approaches/introduction.md @@ -146,23 +146,20 @@ Although it is important to note that this solution could have chosen a better n ```python def triplets_with_sum(number): def calculate_medium(small): - # We have two numbers, but need the third. return (number ** 2 - 2 * number * small) / (2 * (number - small)) two_sides = ( - (int(medium), small) for - small in range(3, number // 3) if - - #Calls calculate_medium and assigns return value to variable medium - small < (medium := calculate_medium(small)) and - medium.is_integer() - ) + (int(medium), small) for small in range(3, number // 3) if + + #Calls calculate_medium and assigns return value to variable medium + small < (medium := calculate_medium(small)) and medium.is_integer() + ) return [ - [small, medium, (medium ** 2 + small ** 2) ** 0.5] - for medium, small in two_sides - ] + [small, medium, (medium ** 2 + small ** 2) ** 0.5] + for medium, small in two_sides + ] ```