I am trying to make a table that has borders in Python. It uses a for loop, to iterate row by row. The problem is, if one of the output numbers contains an additional digit, say from 10 to 100, then the borders will maladjust. I am using f-string literals, but if there is a better way I would like to know.
This is the code I am using to print it:
print(f'| {month:<2}| {payment:,.2f} {principle:,.2f} {interest:,.2f} | {balance:,.2f} | {total_payments:,.2f} {total_principle:,.2f} {total_interest:,.2f} |')
This is what it should look like after a few iterations:
This is what it actually looks like after a few iterations:
I'm not sure if it is relevant to the border question or not, but I also must do indentation properly. I believe I know how to do this already, ex: {x:>6}. Does that effect the borders too?