Problem 163888 · easy · Phase 01 Prerequisites & Setup

Parcel Shipping Cost

conditionals · boolean flags

A courier prices parcels by weight, with an express option. Write shipping_cost(weight_kg, express):

  • up to 1 kg: 5
  • more than 1 kg and up to 5 kg: 8
  • more than 5 kg and up to 20 kg: 15
  • more than 20 kg: 30

Express delivery doubles the price.

Examples

Input:  weight_kg = 0.5, express = False
Output: 5

Input:  weight_kg = 3, express = True
Output: 16

Input:  weight_kg = 25, express = False
Output: 30

Constraints

  • 0 < weight_kg <= 1000
  • express is a boolean

Goals

  • Choose a tier with if/elif/else
  • Apply a multiplier after the tier has been chosen
Starting Python…