From 53ef01ad0900853230861ff9caa7c927a4b0b2b6 Mon Sep 17 00:00:00 2001 From: freezed <2160318-free_zed@users.noreply.gitlab.com> Date: Fri, 16 Apr 2021 00:06:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Lint=20the=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using `black`, `pylint` & `flake8` relate to forga/process/fr/embarquement#6 --- tuto-pysdur/pgcd.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tuto-pysdur/pgcd.py b/tuto-pysdur/pgcd.py index 80bc786..343281b 100644 --- a/tuto-pysdur/pgcd.py +++ b/tuto-pysdur/pgcd.py @@ -17,10 +17,10 @@ The goal is to build durable python script using standard library """ -def pgcd(a,b): +def pgcd(input_a, input_b): """ This function find the Greatest Common Divisor (PGCD in French) - between a & b + between input_a & input_b :Tests: >>> pgcd(561, 357) @@ -32,18 +32,19 @@ def pgcd(a,b): >>> pgcd(910, 42) 14 """ - rest = a - b - check = b - rest + rest = input_a - input_b + check = input_b - rest while check != 0: - a = max(b, rest) - b = min(b, rest) - rest = a - b - check = max(b, rest) - min(b, rest) + input_a = max(input_b, rest) + input_b = min(input_b, rest) + rest = input_a - input_b + check = max(input_b, rest) - min(input_b, rest) print(rest) -if __name__ == '__main__': +if __name__ == "__main__": import doctest + doctest.testmod()