Facebook
From 1111111111, 3 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 444
  1. txt_res1 = "низька. Терміново зверніться до лікаря!"
  2. txt_res2 = "задовільна. Зверніться до лікаря!"
  3. txt_res3 = "середня. Можливо, варто додатково обстежитись у лікаря."
  4. txt_res4 = "вище середнього"
  5. txt_res5 = "висока"
  6. class Experiment():
  7.     def results(a):
  8.         if a.exp.age < 7:
  9.             a.index = 0
  10.             return "Немає даних про такий вік"
  11.  
  12.         a.index = (4 * (int(a.exp.t1) + int(a.exp.t2) + int(a.exp.t3)) - 200) / 10
  13.  
  14.         if a.exp.age in {7, 8}:
  15.             if a.index >= 21:
  16.                 return txt_res1
  17.             elif 17 <= a.index < 21:
  18.                 return txt_res2
  19.             elif 12 <= a.index < 17:
  20.                 return txt_res3
  21.             elif 6.5 <= a.index < 12:
  22.                 return txt_res4
  23.             else:
  24.                 return txt_res5
  25.  
  26.         elif a.exp.age in {9, 10}:
  27.             if a.index >= 19.5:
  28.                 return txt_res1
  29.             elif 15.5 <= a.index < 19.4:
  30.                 return txt_res2
  31.             elif 10.5 <= a.index < 15.4:
  32.                 return txt_res3
  33.             elif 5 <= a.index < 10.4:
  34.                 return txt_res4
  35.             else:
  36.                 return txt_res5
  37.        
  38.         elif a.exp.age in {11, 12}:
  39.             if a.index >= 18:
  40.                 return txt_res1
  41.             elif 14 <= a.index < 17.9:
  42.                 return txt_res2
  43.             elif 9 <= a.index < 13.9:
  44.                 return txt_res3
  45.             elif 3.5 <= a.index < 8.9:
  46.                 return txt_res4
  47.             else:
  48.                 return txt_res5
  49.        
  50.         elif a.exp.age in {13, 14}:
  51.             if a.index >= 16.5:
  52.                 return txt_res1
  53.             elif 12.5 <= a.index < 16.4:
  54.                 return txt_res2
  55.             elif 7.5 <= a.index < 12.4:
  56.                 return txt_res3
  57.             elif 2 <= a.index < 7.4:
  58.                 return txt_res4
  59.             else:
  60.                 return txt_res5
  61.            
  62.         elif a.exp.age in {a.index > 15}:
  63.             if a.index >= 15:
  64.                 return txt_res1
  65.             elif 11 <= a.index < 14.9:
  66.                 return txt_res2
  67.             elif 6 <= a.index < 10.9:
  68.                 return txt_res3
  69.             elif 0.5 <= a.index < 5.9:
  70.                 return txt_res4
  71.             else:
  72.                 return txt_res5