Advertisement
Schleimpilz

Aufgabe 1 vom 20.05.19

May 27th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. import math as m
  2.  
  3. X=2500
  4.  
  5.  
  6. #Aufgabe 1, b)
  7. def tax(incomePerMonth):
  8.     incomePerYear=(12*incomePerMonth)
  9.  
  10.     if incomePerYear>53666:
  11.         taxPay=(0.42*incomePerYear)
  12.  
  13.     elif incomePerYear>53666:
  14.         taxPay=(0.24*incomePerYear)
  15.    
  16.     elif incomePerYear>8820:
  17.         taxPay=(0.14*incomePerYear)
  18.    
  19.     else:
  20.         taxPay=0
  21.  
  22.     return(taxPay)
  23.  
  24.  
  25. #Aufgabe 1, c)
  26. #erster Input is das monatliche einkommen, zweiter input(optional) das zu versteuernde startkapital(das is doch mit"die Finanzen des betreffenden Einwohners" gemeint?)
  27. def taxAdvanced(incomePerMonth,initialMoney=0):
  28.     incomePerYear=(12*incomePerMonth)
  29.  
  30.     if incomePerYear>53666:
  31.         taxPay=(0.42*(incomePerYear+initialMoney))
  32.  
  33.     elif incomePerYear>53666:
  34.         taxPay=(0.24*(incomePerYear+initialMoney))
  35.    
  36.     elif incomePerYear>8820:
  37.         taxPay=(0.14*(incomePerYear+initialMoney))
  38.    
  39.     else:
  40.         taxPay=0
  41.  
  42. #output ist das verbleibende geld wenn der Einkommenssteuersatz auf das gesamte kapital angewandt wird. Ich hab echt keine Ahnung wie die Aufgabe gemeint ist.
  43.     return(initialMoney-taxPay)
  44.  
  45.  
  46. #Aufgabe 1, a)        
  47. print("Aufgabe 1, a)")
  48. while X<=4000:
  49.     print("Citizen with income {}€ has to pay {}€ in taxes".format(X,m.floor(tax(X))))
  50.     X=(X+100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement