4/7 Transportation


What is wrong with my code?

Error Message:
Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Your code threw the following error: invalid syntax (python, line 18)

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
        return "Enter one of the following locations: Charlotte, Tampa, Pittsburgh, or Los Angeles."

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


you need colons after your if and elif statements


9 posts were split to a new topic: What's wrong with my code?


//-- You cannot get both of the above discounts. // .. No one seems to be adding this condition.
shouldn't it be like
elif days >= 7 and days >= 3:
return "You can't get both discounts Mr. Smarty Pants."


Well, not no one. You did.

When done in order, ruling out 7 days or more leaves only less than 7 in the pipeline.We want the next discount point, only, days >= 3.