Answer to Question #48037 in Python for dj

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
1
Expert's answer
2014-10-21T12:54:51-0400
#!/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 )

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS