Advertisement
Spocoman

Courier Express

Jan 8th, 2022 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. weight = float(input())
  2. service = input()
  3. distance = float(input())
  4.  
  5. km_price = 0
  6. if weight < 1:
  7.     km_price = 0.03
  8. elif 1 <= weight < 10:
  9.     km_price = 0.05
  10. elif 10 <= weight < 40:
  11.     km_price = 0.1
  12. elif 40 <= weight < 90:
  13.     km_price = 0.15
  14. elif 90 <= weight < 150:
  15.     km_price = 0.2
  16.  
  17. express = 0
  18. if service == 'express':
  19.     if weight < 1:
  20.         express = km_price / 100 * 80
  21.     elif 1 <= weight < 10:
  22.         express = km_price / 100 * 40
  23.     elif 10 <= weight < 40:
  24.         express = km_price / 100 * 5
  25.     elif 40 <= weight < 90:
  26.         express = km_price / 100 * 2
  27.     elif 90 <= weight < 150:
  28.         express = km_price / 100
  29.  
  30. total = km_price * distance + express * weight * distance
  31. print(f'The delivery of your shipment with weight of {weight:.3f} kg. would cost {total:.2f} lv.')
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement