Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2022
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. weight_in_kg = float(input())
  2. delivery_type = input()
  3. distance_in_km = int(input())
  4.  
  5. base_price_per_km = 0.03
  6.  
  7. if 1 <= weight_in_kg <= 10:
  8.     base_price_per_km = 0.05
  9. elif 10 <= weight_in_kg <= 40:
  10.     base_price_per_km = 0.10
  11. elif 40 <= weight_in_kg <= 90:
  12.     base_price_per_km = 0.15
  13. elif 90 <= weight_in_kg <= 150:
  14.     base_price_per_km = 0.20
  15.  
  16. express_delivery_price = 0.0
  17.  
  18. if delivery_type == 'express':
  19.     if weight_in_kg < 1.0:
  20.         express_delivery_price = 0.80
  21.     elif 1 <= weight_in_kg <= 10:
  22.         express_delivery_price = 0.40
  23.     elif 10 <= weight_in_kg <= 40:
  24.         express_delivery_price = 0.05
  25.     elif 40 <= weight_in_kg <= 90:
  26.         express_delivery_price = 0.02
  27.     elif 90 <= weight_in_kg <= 150:
  28.         express_delivery_price = 0.01
  29.     express_delivery_price *= base_price_per_km
  30.  
  31. total_price = (base_price_per_km + weight_in_kg * express_delivery_price) * distance_in_km
  32.  
  33. print(f"The delivery of your shipment with weight of {weight_in_kg:.3f} kg. would cost {total_price:.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement