60 426
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #52602 in Python for stephanie

Question #52602
what am i doing wrong here?
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


DAYS = 7


def main():



index = 0
sales = [0] * DAYS
while index < DAYS:
print('Day #', index + 1, ': ', sep='', end='')
sales[index] = float(input())
index += 1

total = 0

for index in range(DAYS):
total += sales
print('Enter the sales for each day.')
main()
Expert's answer
Code. 
DAYS = 7
 
def main():
    index = 0
    sales = [0] * DAYS
    while index < DAYS:
        print('Day #', index + 1, ': ', sep='', end='')
       sales[index] = float(input())
       index += 1
 
    total = 0
 
    for index in range(DAYS):
       total += sales[index]
   
    print('Total sales: ', total)
 
print('Enter the sales for each day.')
main()

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

stephanie
12.05.15, 07:36

this is as far as i can get it to go :

DAYS = 7


def main():
index = 0
sales = [0] * DAYS
while index < DAYS:
print('Day #', index + 1, ': $', sep='', end='')
sales[index] = float(input())
index += 1

total = 0

for sales in range(DAYS):
total += sales
print('total is: $ ', total)
print('Enter the sales for each day.')

main()

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions