fork download
  1. # your code goes hereprint("Система расчёта штрафов")
  2.  
  3. # Скорость автомобиля
  4. car_speed = 111
  5.  
  6. # True = внутри населённого пункта, False = вне населённого пункта
  7. is_town = True
  8.  
  9. # Штрафы в населённых пунктах
  10. town_fine_for_1_to_10 = 30
  11. town_fine_for_11_to_15 = 50
  12. town_fine_for_16_to_20 = 70
  13. town_fine_for_21_to_25 = 115
  14. town_fine_for_26_to_30 = 180
  15. town_fine_for_31_to_40 = 260
  16. town_fine_for_41_to_50 = 400
  17. town_fine_for_51_to_60 = 560
  18. town_fine_for_61_to_70 = 700
  19. town_fine_for_over_70 = 800
  20.  
  21. # Штрафы вне населённых пунктов
  22. country_fine_for_1_to_10 = 20
  23. country_fine_for_11_to_15 = 40
  24. country_fine_for_16_to_20 = 60
  25. country_fine_for_21_to_25 = 100
  26. country_fine_for_26_to_30 = 150
  27. country_fine_for_31_to_40 = 200
  28. country_fine_for_41_to_50 = 320
  29. country_fine_for_51_to_60 = 480
  30. country_fine_for_61_to_70 = 600
  31. country_fine_for_over_70 = 700
  32.  
  33. # Разрешённая скорость
  34. town_speed = 50
  35. country_speed = 70
  36.  
  37. # Вычисляем превышение
  38. if is_town:
  39. over_speed = car_speed - town_speed
  40. else:
  41. over_speed = car_speed - country_speed
  42.  
  43. # Проверяем превышение
  44. if over_speed <= 0:
  45. print("Скорость не превышена")
  46. elif over_speed >= 1 and over_speed <= 10:
  47. print("Штраф:", town_fine_for_1_to_10)
  48. elif over_speed >= 11 and over_speed <= 15:
  49. print("Штраф:", town_fine_for_11_to_15)
  50. elif over_speed >= 16 and over_speed <= 20:
  51. print("Штраф:", town_fine_for_16_to_20)
  52. elif over_speed >= 21 and over_speed <= 25:
  53. print("Штраф:", town_fine_for_21_to_25)
  54. elif over_speed >= 26 and over_speed <= 30:
  55. print("Штраф:", town_fine_for_26_to_30)
  56. elif over_speed >= 31 and over_speed <= 40:
  57. print("Штраф:", town_fine_for_31_to_40)
  58. elif over_speed >= 41 and over_speed <= 50:
  59. print("Штраф:", town_fine_for_41_to_50)
  60. elif over_speed >= 51 and over_speed <= 60:
  61. print("Штраф:", town_fine_for_51_to_60)
  62. elif over_speed >= 61 and over_speed <= 70:
  63. print("Штраф:", town_fine_for_61_to_70)
  64. elif over_speed > 70:
  65. print("Штраф:", town_fine_for_over_70)
  66.  
Success #stdin #stdout 0.07s 14144KB
stdin
Standard input is empty
stdout
Штраф: 700