Total Sales
Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in a list. Use a loop to calculate the total sales for the week and display the result.
Total Sales Python code:
#Prompt and asks the user to enter a store’s sales for each day of the week.
#The amounts should be stored in a list. Use a loop to calculate the total
#sales for the week and display the result.
daysOfWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
totalSales = []
# Ask user for sales input for each day of the week
for day in daysOfWeek:
sale = float(input(f"Enter sales for {day}: "))
totalSales.append(sale)
# Calculate the total sales for the week
total = sum(totalSales)
# Display the total sales
print(f"\nTotal sales for the week: ${total:.2f}")
Executed Output:
Enter sales for Monday: 250
Enter sales for Tuesday: 100
Enter sales for Wednesday: 200
Enter sales for Thursday: 300
Enter sales for Friday: 400
Enter sales for Saturday: 100
Enter sales for Sunday: 10
Total sales for the week: $1360.00