Created
December 31, 2012 11:50
-
-
Save Lysander/4419280 to your computer and use it in GitHub Desktop.
Simple proposal for the exercise in this thread: http://www.python-forum.de/viewtopic.php?f=1&t=30699
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # was auch immer das sein mag... | |
| CRITICAL_LIMIT = 4000 | |
| def calc_tax_value(salary, tax_rate): | |
| return salary * tax_rate / 100 | |
| def calc_tax(salary, married, limit): | |
| if married: | |
| if salary < limit: | |
| return calc_tax_value(salary, 22) | |
| else: | |
| # Was auch immer hier hin muss | |
| return 0 | |
| else: | |
| if salary < limit: | |
| return calc_tax_value(salary, 26) | |
| else: | |
| return 0 | |
| def main(): | |
| salary = float(input("Gehalt in Brutto:")) | |
| married = input("Familienstand (verheiratet / ledig):").lower().startswith("v") | |
| print("Der monatlich zu zahlende Steuerbetrag betraegt {} Euro.".format( | |
| calc_tax(salary, married, CRITICAL_LIMIT))) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment