Transpotation code is not working



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

I expected all of the days to be correct because all the math is correct

def hotel_cost(nights):
    return 140*nights
def plane_ride_cost(city):
    if city =="Charlotte":
        return 183
    elif city =="Tampa":
        return 220
    elif city == "Pittsburgh":
        return 222
    elif city == "Los Angeles":
        return 475
def rental_car_cost(days):
    cost = days*40
    if days>=7:
        return cost1
    elif days>7 and days >=3:
        cost=cost - 20
        return cost 20
        return cost


 return cost 20

error: invalid syntax

simply return cost

also in your first condition you wrote
if days>=7:

then why do you need to put the same condition in elif
elif days>7

the instruction is something else.


Right now your code reads that if the days are greater than seven and greater than or equal to three, subtract $20 from the cost.

It should read that if the days are less than seven and greater than or equal to three, substract $20 from the cost.


thank you, I fixed it and saw the problem


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