We are creating a spreadsheet type table that holds values from user inputs. I need to have it so commas are added automatically. EX: 120220 needs to be 120,220 and I need a $ infront, so the final product would be $120,200
I have tried adding the money sign just infront naturally but it didn't work
print("1st Quarter Sales")
print("{:<20s}{:<20s}{:<20s}" .format("ITEM" , "QUANTITY" , "TOTAL SALES COST"))
print("{:<20s}{:<20d}{:<20d}" .format(desktop , desktop_1q , q1_desktop))
print("{:<20s}{:<20d}{:<20d}" .format(laptop, laptop_1q, q1_laptop))
print("{:<20s}{:<20d}{:<20d}" .format(printer, printer_1q, q1_printer))
print("Total Sales: $" , q1_total , sep="")
This is just the printed version, above are the inputs and then taking those inputs and multiplying them to get subtotals and stuff. "desktop" is just a string that says DESKTOP same with laptop and printer. desktop_1q printer_1q and laptop_1q is the quantity sold and for the q1_'S are the total sales so just cost of that product * quantity.
Final result with added commas and $ should look like $1,320,500