Advertisement
bousaid

Python IRG 2022 Function

Nov 26th, 2022 (edited)
795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | Source Code | 0 0
  1. # IRG 2022 Function By BOUSSAID MUSTAFA
  2. # APC SALI ADRAR 2022
  3. from math import floor
  4.  
  5.  
  6. def irg_2022(typeirg, soumis):
  7.     t00 = 20000
  8.     t01 = 4600
  9.     t02 = 10800
  10.     t03 = 24000
  11.     t04 = 52800
  12.     p = floor(soumis / 10) * 10
  13.     if soumis <= 30009:
  14.         irg = 0
  15.     else:
  16.         if 30010 <= soumis <= 40000:
  17.             irg = (p - t00) * 0.23
  18.  
  19.         elif 40000 < soumis <= 80000:
  20.             irg = (p - 40000) * 0.27 + t01
  21.  
  22.         elif 80001 < soumis <= 160000:
  23.             irg = (p - 80000) * 0.30 + t01 + t02
  24.  
  25.         elif 160001 < soumis <= 320000:
  26.             irg = (p - 80000) * 0.33 + t01 + t02 + t03
  27.  
  28.         elif soumis > 320000:
  29.             irg = (p - 320000) * 0.35 + t01 + t02 + t03 + t04
  30.  
  31.         else:
  32.             irg = 0
  33.  
  34.         abat = irg * 0.4
  35.         if abat < 1000:
  36.             abat = 1000
  37.         elif abat > 1500:
  38.             abat = 1500
  39.         irg -= abat
  40.  
  41.         match typeirg:
  42.             case 1:  # ---->Normal
  43.                 if soumis < 35000:
  44.                     irg = (irg * 137 / 51) - (27925 / 8)
  45.  
  46.             case 2:  # ---->Handicape
  47.                 if soumis < 42500:
  48.                     irg = (irg * 93 / 61) - (81213 / 41)
  49.  
  50.         irg = round(irg, 1)
  51.  
  52.         return irg
  53.  
  54.  
  55. # Resulta
  56. x = irg_2022(1, 67203.45)
  57.  
  58. print(x)
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement