Advertisement
Denis2312

Ex3courier_express

Apr 20th, 2024
824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. weight = float(input())
  2. type_courier = input()
  3. distance = int(input())
  4.  
  5. total = 0
  6.  
  7. if type_courier == "standard":
  8.     if weight < 1:
  9.         total = distance * 0.03
  10.     elif 1 < weight <= 10:
  11.         total = distance * 0.05
  12.     elif 11 <= weight <= 40:
  13.         total = distance * 0.10
  14.     elif 41 <= weight <= 90:
  15.         total = distance * 0.15
  16.     elif 91 <= weight <= 150:
  17.         total = distance * 0.20
  18.  
  19. elif type_courier == "express":
  20.     if weight < 1:
  21.         total = distance * 0.03 + 0.3 * 0.8 * weight * distance
  22.     elif weight <= 10:
  23.         total = distance * 0.05 + 0.5 * 0.4 * weight * distance
  24.     elif 11 <= weight <= 40:
  25.         total = distance * 0.10 + 0.10 * 0.05 * weight * distance
  26.     elif 41 <= weight <= 90:
  27.         total = distance * 0.15 + 0.15 * 0.02 * weight * distance
  28.     elif 91 <= weight <= 150:
  29.         total = distance * 0.20 + 0.20 * 0.01 * weight * distance
  30.  
  31. else:
  32.     print("Invalid service type.")
  33.     exit()
  34.  
  35. print(f"The delivery of your shipment with weight of {weight:.3f} kg. would cost {total:.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement