#Theater Seating Revenue #by Robert Layton SECTION_A_PRICE = 20 SECTION_B_PRICE = 15 SECTION_C_PRICE = 10 SECTION_A_SEATS = 300 SECTION_B_SEATS = 500 SECTION_C_SEATS = 200 section_a_sold = 0 section_b_sold = 0 section_c_sold = 0 #Welcome user print '\nWelcome to the ticket review program.' #GET SECTION A SALES section_a_sold = input("\nEnter the number of tickets sold in Section A: ") while(section_a_sold < 0 or section_a_sold > SECTION_A_SEATS): print("\nThe number of tickets sold is invalid.") section_a_sold = input("\nEnter the number of tickets sold in Section A: ") #GET SECTION B SALES section_b_sold = input("\nEnter the number of tickets sold in Section B: ") while(section_b_sold < 0 or section_b_sold > SECTION_B_SEATS): print("\nThe number of tickets sold is invalid.") section_b_sold = input("\nEnter the number of tickets sold in Section B: ") #GET SECTION C SALES section_c_sold = input("\nEnter the number of tickets sold in Section C: ") while(section_c_sold < 0 or section_c_sold > SECTION_C_SEATS): print("\nThe number of tickets sold is invalid.") section_c_sold = input("\nEnter the number of tickets sold in Section C: ") #Calculate total revenue totalTicketSales = 0 totalTicketSales += section_a_sold*SECTION_A_PRICE totalTicketSales += section_b_sold*SECTION_B_PRICE totalTicketSales += section_c_sold*SECTION_C_PRICE print '\n\nThe total revenue from ticket sales is: $' + str(totalTicketSales)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question