Fix padding calculation
This commit is contained in:
7
main.py
7
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user