Fix: Black does its job

This commit is contained in:
2019-10-13 21:01:31 +02:00
parent aba43c9f19
commit 931e55c35e
14 changed files with 98 additions and 67 deletions

View File

@@ -6,4 +6,4 @@ from .pythagore import random_pythagore
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del
# cursor: 16 del

View File

@@ -5,7 +5,7 @@
from random import randint
def random_pythagore(v_min = 1, v_max = 10, nbr_format = lambda x : x) :
def random_pythagore(v_min=1, v_max=10, nbr_format=lambda x: x):
""" Generate a pythagore triplet
:returns: (a,b,c) such that a^2 = b^2 + c^2
@@ -14,10 +14,11 @@ def random_pythagore(v_min = 1, v_max = 10, nbr_format = lambda x : x) :
while u == v:
u, v = randint(v_min, v_max), randint(v_min, v_max)
u, v = max(u, v), min(u, v)
triplet = (u**2+v**2, 2*u*v, u**2-v**2)
triplet = (u ** 2 + v ** 2, 2 * u * v, u ** 2 - v ** 2)
formated_triplet = [nbr_format(i) for i in triplet]
return formated_triplet
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4: