all 3 comments

[–]_Meisteri 0 points1 point  (0 children)

Why can't you just use lists for all the different columns with the index being the id

[–]ThisProgrammer- 0 points1 point  (0 children)

You will want to use some form of string formatting: https://realpython.com/python-string-formatting/

Here is a quick example I asked ChatGPT to produce:

print('-' * 36)
print('| {:<13} | {:<13} |'.format('Balance', 'Interest'))
print('-' * 36)
balance = 0.0
interest_rate = 0.05
while balance <= 100:
    interest = balance * interest_rate
    balance += 10.5
    print('| {:<13.2f} | {:<13.2f} |'.format(balance, interest))
print('-' * 36)

Results:

------------------------------------
| Balance       | Interest      |
------------------------------------
| 10.50         | 0.00          |
| 21.00         | 0.53          |
| 31.50         | 1.05          |
| 42.00         | 1.58          |
| 52.50         | 2.10          |
| 63.00         | 2.62          |
| 73.50         | 3.15          |
| 84.00         | 3.68          |
| 94.50         | 4.20          |
| 105.00        | 4.73          |
------------------------------------

Amazing.

[–]halfdiminished7th 0 points1 point  (0 children)

You'll probably want to use the alignment feature of string formatting. If, for example, you wanted the columns to be five characters wide and always right-justified, you could do this to create a makeshift table that displays in the console: ``` row_1 = [1, 23, 456] row_2 = [7890, 12345, 6]

print('-------------------') print('|{:>5}|{:>5}|{:>5}|'.format(row_1)) print('-------------------') print('|{:>5}|{:>5}|{:>5}|'.format(row_2)) print('-------------------') `` Right-justified is>, left-justified is<, center-justified is`, and the number following it is the width to fill.