#Coco Jones #CIS 122 #Q2 income = 0 totalIncome = 0 ticketSold = int(raw_input("Enter the number of tickets sold in section A\n")) while ticketSold < 1 or ticketSold > 300: ticketSold= int(raw_input("Sorry there are at least 1 seat in section A and no more than 300. Please try again\n")) income += ticketSold * 20 print "Income generated from ticket sales in section A " print income ticketSold = int(raw_input("Enter the number of tickets sold in section B\n")) while ticketSold < 1 or ticketSold > 500: ticketSold= int(raw_input("Sorry there are at least 1 seat in section B and no more than 500. Please try again\n")) income += ticketSold * 15 print "Income generated from ticket sales in section B " print income ticketSold = int(raw_input("Enter the number of tickets sold in section C\n")) while ticketSold < 1 or ticketSold > 200: ticketSold= int(raw_input("Sorry there are at least 1 seat in section C and no more than 200. Please try again\n")) income += ticketSold * 10 print "Income generated from ticket sales in section C " print income
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