Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that generates a sequence (in a loop) of 25 random integers between 1 and 99. You can use the function: random.randint(a, b)

Write a program that generates a sequence (in a loop) of 25 random integers between 1 and 99. You can use the function: random.randint(a, b) See appendix C "random Module" if you need help on the random number. Where: a <= N <= b . This mean a and b are inclusive. Store the integers in a list (one dimensional list) and then using the functions that are available, do the following: (Hint: See Table 1 & Table 2 in section 6.2) Sum the integers Find the average of the integers (that is a float) Determine the largest and smallest Sort the integers See next page for more problems. This problem may seem hard at first, but you have been given all the information to complete this program. No design needs to be turned in. But you may want to do your own design in-order to figure out how to do the code. Make sure you check for the row-number and column number for an integer between 1 and 5 (but lists use 0 to 4 indices). The New Star Theater has 25 seats, which are set up as 5 rows and 5 columns. The price for each seat is based on the row and column show below. Diagram showing the rows and columns. Fill a 5 x 5 grid. Then do the following. Create a loop that will continue until the user says (Y/N) they want to quit, or all 25 seats are sold. Have the users ask for a seat position based on row and column (row, column) - remember that the lists positions start at 0, but the user will ask for the seat starting at row or column position 1. Then when the user selects the seat, print out the user's price and mark an 'SS' (sold seat) in the List where the price was. Then print out all the seats so the user can select another. When the next user in the loop, asks for a seat make sure you check and see if that seat is already sold (has an SS in the table). If it is sold, tell the user otherwise return the price and mark the seat sold. After the user asks to quit or all the seats are sold, or the loop ends, then printout the list as shown below - showing the sold seats (SS) and unsold seats (the unsold seat should still have a price). Print out the array (as a two-dimensional matrix) showing which seats were sold, and which seats have not been sold.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are some global issues confronting women?

Answered: 1 week ago

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago

Question

How would you assess the value of an approach like this?

Answered: 1 week ago