def revenueStream(x,y): return x*y print "How many seats were sold in Section A?" sectionA = int(raw_input()) while sectionA < 0: print "Please enter a positive number" sectionA = int(raw_input()) while sectionA > 300: print "There are not that many seats in Section A" print "Please enter how many seats were sold in Section A" sectionA = int(raw_input()) rateA = 20 print "How many seats were sold in Section B?" sectionB = int(raw_input()) while sectionB < 0: print "Please enter a positive number" sectionB = int(raw_input()) while sectionB > 500: print "There are not that many seats in Section B" print "Please enter how many seats were sold in Section B" sectionB = int(raw_input()) rateB = 15 print "How many seats were sold in Section C?" sectionC = int(raw_input()) while sectionC < 0: print "Please enter a positive number" sectionC = int(raw_input()) while sectionC > 200: print "There are not that many seats in Section C" print "Please enter how many seats were sold in Section C" sectionC = int(raw_input()) rateC = 10 totalRevenue = revenueStream(sectionA,rateA) + revenueStream(sectionB,rateB) + revenueStream(sectionC, rateC) print "The total revenue from the seats sold today is ${}".format(totalRevenue)
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