Transportaion


#1


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

I believe the code to be correct although it seems to be subtracting 50 from the days cost returning a result of -10 the exact error message I get is below.

Oops, try again. It looks like rental_car_cost returns -10 instead of the correct amount (40) for 1 days.

I believe it is meant to return back to me 40


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


#2

this condition:

if days <= 7:

if the car is rented car for 7 days or less, given 50$ discount. That can't be right, the instructions state: if the car is rented for 7 days or more give 50$ discount

same here:

elif days <= 3 and days >= 7:

if the car is rented less then 3 days and more then 7 days (very impressive) give 20$ discount

You need to rethink your condition operators


#3

Thank you, I see where I went wrong. I needed to flip around my operators in both instances. I supposed it is what happens after a few hours of code exercises. Thank you so much for your help.


#4