Add column width
This commit is contained in:
parent
a64106f262
commit
703341f267
1 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@ Calcule le PGCD de deux nombres et trouve les coefficients de Bezout.
|
|||
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
assert len(sys.argv) == 3
|
||||
a = int(sys.argv[1])
|
||||
|
@ -30,10 +31,14 @@ def main():
|
|||
|
||||
print_table(r, u, v, q)
|
||||
|
||||
|
||||
def print_table(r, u, v, q):
|
||||
"""Représentation de l'algorithme"""
|
||||
|
||||
width = max((len(str(i)) for i in r))
|
||||
|
||||
for i in range(len(r)):
|
||||
print(f"{r[i]:^5} {u[i]:^5} {v[i]:^5} {q[i]:^5}")
|
||||
print(f"{r[i]:^{width}} {u[i]:^{width}} {v[i]:^{width}} {q[i]:^{width}}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue