Create formatted table using f-strings

In this exercise, you will create a neatly formatted table using f-strings. Adjust the formatting of each table row to ensure that each cell has a minimum width of 10 characters, right-aligns the values, and displays the total values with 2 decimal places.
products = [ {'name': 'A', 'quantity': 4, 'unit_price': 19.99}, {'name': 'B', 'quantity': 2, 'unit_price': 29.9}, {'name': 'C', 'quantity': 20, 'unit_price': 57.14}, {'name': 'D', 'quantity': 3, 'unit_price': 13} ] print(f'{'Product':>10}{'Quantity':>10}{'Total':>10}') print('-----------------------------------') for product in products: total = product['quantity'] * product['unit_price'] ##### format the table rows here... #####
print(f"{product['name']}{product['quantity']}{total}")
# expected output: # Product Quantity Total # ----------------------------------- # A 4 79.96 # B 2 59.80 # C 20 1142.80 # D 3 39.00
Python
Setting up Python environment...
Output