From 2db496c4d79def3b216eae79915b4712cbf2926a Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Fri, 19 Aug 2022 08:14:19 +0200 Subject: [PATCH] Fix padding calculation --- main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e59d29f..cfcfd19 100644 --- a/main.py +++ b/main.py @@ -59,7 +59,12 @@ def print_standings(players, guesses, results): else: text = f"??? / {guesses[player][num_round - 1]} (?)" - pad = " " * (width - len(text) - 2) + # Remove invisivle characters for padding calculation + clean = text + for color in COLORS.values(): + clean = clean.replace(color, '') + pad = " " * (width - len(clean) - 2) + print(f" {pad}{text} |", end="") print()