“…recommend embedding those lines in format strings too…”
print(f'| {line:{target_length}} |')
How would the fString be included in this example from above? Parsing the formatted string as a list item obscures the fString coding (turns the iterated line into a pure string literal).
current_money = 10
lines = [" You start with ${current_money}",
" Each play costs 25 cents."]
target_length =35
print()
for line in lines:
print(f'| {line:{target_length}} |')
| You start with ${current_money} |
| Each play costs 25 cents. |