65 767
Assignments Done
99,4%
Successfully Done
In October 2018

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
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  )

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions