ticketsA = input('Please enter tickets for section A: ') print ticketsA ticketsB = input('Please enter tickets for section B: ') print ticketsB ticketsC = input('Please enter tickets for section C: ') print ticketsC sectionA=300 sectionB=500 sectionC=200 def sectionAVal(ticketsA, sectionA): if ticketsA <= sectionA: sectionA = sectionA - ticketsA print 'You have purchased',ticketsA,'tickets in section A. There are',sectionA,'tickets remaining.' else: print 'There are no more tickets available in secion A' def sectionBVal(ticketsB, sectionB): if ticketsB <= sectionB: sectionB = sectionB - ticketsB print 'You have purchased',ticketsB,'tickets in section B. There are',sectionB,'tickets remaining.' else: print 'There are no more tickets available in secion B' def sectionCVal(ticketsC, sectionC): if ticketsC <= sectionC: sectionC = sectionC - ticketsC print 'You have purchased',ticketsC,'tickets in section C. There are',sectionC,'tickets remaining.' else: print 'There are no more tickets available in secion C' sectionAVal(ticketsA, sectionA) sectionBVal(ticketsB, sectionB) sectionCVal(ticketsC, sectionC) incomeA = float(ticketsA * 20) print 'Total income generated from secion A: ',incomeA incomeB = float(ticketsB * 15) print 'Total income generated from secion B: ',incomeB incomeC = float(ticketsC * 10) print 'Total income generated from secion C: ',incomeC
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