Answer:
Program given below
Explanation:
Total Sales
Assign the values of the variable as “Enter the store sales for Sunday” in Sun
Assign the values of the variable as “Enter the store sales for Monday” in Mon
Assign the values of the variable as “Enter the store sales for Tuesday” in Tue
Assign the values of the variable as “Enter the store sales for Wednesday” in Wed
Assign the values of the variable as “Enter the store sales for Thursday” in Thu
Assign the values of the variable as “Enter the store sales for Friday” in Fri
Assign the values of the variable as “Enter the store sales for Saturday” in Sat
Assign the values for the variable in array as [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
Initialize tot = 0
Use the loop for calculating the total sales for the week,
for total_sales in store_sales:
tot += total_sales
then display the result as,
print "\n Total week sales = %2.f " %tot
sun = int(input("\n Enter the store sales for Sunday: "))
mon = int(input("\n Enter the store sales for Monday: "))
tue = int(input("\n Enter the store sales for Tuesday: "))
wed = int(input("\n Enter the store sales for Wednesday: "))
thu = int(input("\n Enter the store sales for Thursday: "))
fri = int(input("\n Enter the store sales for Friday: "))
sat = int(input("\n Enter the store sales for Saturday: "))
store_sales = [sun, mon, tue, wed, thu, fri, sat]
tot = 0
for store_sale in store_sales:
tot += store_sale
print "\n Total Week Sales: %2.f" %tot
We will have the following output:
<u>OUTPUT
</u>
<u>
</u>Enter the store sales for Sunday: 45
Enter the store sales for Monday: 56
Enter the store sales for Tuesday: 89
Enter the store sales for Wednesday:78
Enter the store sales for Thursday: 45
Enter the store sales for Friday: 12
Enter the store sales for Saturday: 23
Total Week Sales: 348