DEV Community

Discussion on: Daily Challenge #280 - Driving School

Collapse
 
bencardinal profile image
Ben Cardinal
def cost(minutes):
   if minutes <= 5:
      return 0

   if minutes <= 65:
      return 30

   minutes -= 65
   # Could also use math.ceil() here but didn't want the dependency on math for this example
   half_hours = minutes // 30 + (minutes % 30 > 0)
   return 30 + half_hours * 10