I am in the process of learning Python for my college course and I seem to be stuck. I am attempting to export an expense report output to my lists into a table format. The header information is supposed to be underlined which I cant figure out and the spacing needs to be consistent with the header information. Looking for any recommendations to simplify any coding and how you came to the conclusion. Here is my code to this point:
#Underlining solutions for spreadsheet_text?
spreadsheet_text = ["Item","Price","QTY","Total"]
print(*spreadsheet_text,"\n")
#List zipping is used to combine multiple lists in one display
spreadsheet = "\n".join("{:<8} {:^10} {:^6} {:>8}".format(a, b, c, d) for a, b, c, d in list(zip(item_list, item_price_list, quantity_list, total_list)))
print(spreadsheet,"\n")
# fee = "\n".join("{:<8} {:>8}".format(a, b) for a, b in list(zip(fee_list, totalofsums_list)))
# print(fee,"\n")
# print(totalofsums+fee,"\n")
print("Commute Fee:", "$",fee,"\n")
print("Total Sums: $",totalofsums + fee,"\n")
break
#Calculator is working. Just need to work on list display.
print("Have a Nice Day!")
Example:
Item Price Qty Total
Item #1 3.5 2 7.0
Item #2 1.5 2 3.0
Commute 5.0
Total 15.0
but in a nice table?