tax.py 731 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. """
  2. 输入月收入和五险一金计算个人所得税
  3. Version: 0.1
  4. Author: 骆昊
  5. Date: 2018-02-28
  6. """
  7. salary = float(input('本月收入: '))
  8. insurance = float(input('五险一金: '))
  9. diff = salary - insurance - 3500
  10. if diff <= 0:
  11. rate = 0
  12. deduction = 0
  13. elif diff < 1500:
  14. rate = 0.03
  15. deduction = 0
  16. elif diff < 4500:
  17. rate = 0.1
  18. deduction = 105
  19. elif diff < 9000:
  20. rate = 0.2
  21. deduction = 555
  22. elif diff < 35000:
  23. rate = 0.25
  24. deduction = 1005
  25. elif diff < 55000:
  26. rate = 0.3
  27. deduction = 2755
  28. elif diff < 80000:
  29. rate = 0.35
  30. deduction = 5505
  31. else:
  32. rate = 0.45
  33. deduction = 13505
  34. tax = abs(diff * rate - deduction)
  35. print('个人所得税: ¥%.2f元' % tax)
  36. print('实际到手收入: ¥%.2f元' % (diff + 3500 - tax))