Question #48037

design a program that asks the user to enter a store sales for each day of the week. The amount should be stored in a list. use a loop to calculate the total sales for the week and display the result in python

Expert's answer

#!/usr/bin/env python3
import sys
sales = []
for day in range(1, 8):
val = input("Day {0}: ".format(day) )
try:
sales.append( int(val) )
except:
print("Incorrect value")
sys.exit()
total_amount = 0
for day in sales:
total_amount += day
print( "Total amount:", total_amount )
LATEST TUTORIALS
APPROVED BY CLIENTS