# Sample sales data
sales_data = {
'Product': ['Product A', 'Product B', 'Product C', 'Product A', 'Product B'],
'Quantity': [100, 150, 200, 120, 180],
'Price': [10, 12, 15, 10, 12]
}
# Creating a HTML sales report
html_report = """
Sales Report
Sales Report
| Product |
Total Sales |
"""
# Calculating total sales and generating HTML table rows
for product, quantity, price in zip(sales_data['Product'], sales_data['Quantity'], sales_data['Price']):
total_sales = quantity * price
html_report += f"""
| {product} |
{total_sales} |
"""
html_report += """
"""
# Saving HTML report to a file
with open("sales_report.html", "w") as file:
file.write(html_report)
Sales Report
Sales Report
| Product |
Quantity |
Price |
Total Sales |
| Product A |
100 |
$10 |
$1000 |
| Product B |
150 |
$12 |
$1800 |