# Marginal Discount Calculator by Kevin L Davenport @ http://kldavenport.com import locale locale.setlocale(locale.LC_ALL, 'en_US') month_prompt_text = str("Your monthly cost is: $ ") annual_prompt_text = str(" Your annual cost is: $ ") def calculator(seats): price = 0 monthly_cost = 0 if seats <= 500: price = 15 monthly_cost = seats * price annual_cost = monthly_cost * 12 print month_prompt_text + locale.format("%d", monthly_cost, grouping = True) + \ annual_prompt_text + locale.format("%d", annual_cost, grouping = True) elif seats <= 750 and seats >= 501: price = 13.5 monthly_cost = (7500) + (seats - 500) * price annual_cost = monthly_cost * 12 print month_prompt_text + locale.format("%d", monthly_cost, grouping = True) + \ annual_prompt_text + locale.format("%d", annual_cost, grouping = True) elif seats <= 1000 and seats >= 751: price = 12 monthly_cost = (7500 + 3375) + (seats - 750) * price annual_cost = monthly_cost * 12 print month_prompt_text + locale.format("%d", monthly_cost, grouping = True) + \ annual_prompt_text + locale.format("%d", annual_cost, grouping = True) elif seats <= 2000 and seats >= 1001: price = 11.5 monthly_cost = (7500 + 3375 + 3000) + (seats - 1000) * price annual_cost = monthly_cost * 12 print month_prompt_text + locale.format("%d", monthly_cost, grouping = True) + \ annual_prompt_text + locale.format("%d", annual_cost, grouping = True) elif seats <= 4000 and seats >= 2001: price = 9.75 monthly_cost = (7500 + 3375 + 3000 + 11500) + (seats - 2000) * price annual_cost = monthly_cost * 12 print month_prompt_text + locale.format("%d", monthly_cost, grouping = True) + \ annual_prompt_text + locale.format("%d", annual_cost, grouping = True) elif seats <= 6000 and seats >= 4001: price = 9.75 monthly_cost = (7500 + 3375 + 3000 + 11500 + 19500) + (seats - 4000) * price annual_cost = monthly_cost * 12 print month_prompt_text + locale.format("%d", monthly_cost, grouping = True) + \ annual_prompt_text + locale.format("%d", annual_cost, grouping = True) else: print "Please discuss licensing with your service account manager" calculator(4500)
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