Transportation


#1



https://www.codecademy.com/courses/python-beginner-P5YtY/1/3?curriculum_id=4f89dab3d788890003000096#


Oops, try again. It looks like rental_car_cost returns 120 instead of the correct amount (100) for 3 days.


cant figure out why this keeps happening, have read other transportation threads but not really understanding moderators explanation/ help.


def rental_car_cost(days):
     return 40 * days 
     if days >= 7:
          return rental_car_cost - 50
     elif days >= 3 and days <= 6:
          return rental_car_cost - 20


#2

how does function minus twenty work? shouldn't you calculate the cost for renting a car an x amount of days, then check if i need to apply discount, and then return the cost?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.