191k views
2 votes
Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in an array. Use a loop to calculate the total sales for the week and display the result.

Need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code.
Lottery Number Generator

Design a program that generates a 7-digit lottery number. The program should have an Integer array with 7 elements. Write a loop that steps through the array, randomly generating a number in the range of 0 through 9 for each element. (Use the random function that was discussed in Chapter 6.) Then write another loop that displays the contents of the array.

Need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code.

User Jumhyn
by
5.9k points

1 Answer

2 votes

Answer:

Program given below

Step-by-step 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 "\\ Total week sales = %2.f " %tot

sun = int(input("\\ Enter the store sales for Sunday: "))

mon = int(input("\\ Enter the store sales for Monday: "))

tue = int(input("\\ Enter the store sales for Tuesday: "))

wed = int(input("\\ Enter the store sales for Wednesday: "))

thu = int(input("\\ Enter the store sales for Thursday: "))

fri = int(input("\\ Enter the store sales for Friday: "))

sat = int(input("\\ 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 "\\ Total Week Sales: %2.f" %tot

We will have the following output:

OUTPUT

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

User Andrew Coleson
by
6.0k points