Taking a Vacation - Transportation



File "python", line 19
elif days >= 3:
SyntaxError: invalid syntax

I don't know whats wrong with that elif.

Replace this line with your code. def hotel_cost(nights):
        return 140 * nights
def plane_ride_cost(city):
        if plane_ride_cost("Charlotte"):
            return (183)
            if plane_ride_cost("Tampa"):
                return (220)
                if plane_ride_cost("Pittsburgh"):
                    return (222)
                    if plane_ride_cost("Los Angeles"):
                        return (475)
def rental_car_cost(days):
 rental_car_cost = 40 * days
 if days >= 7:
        rental_car_cost -= 50
        elif days >= 3:
                rental_car_cost -= 20
                return total cost


Try getting elif to work in a minimal example. Then compare to yours and/or try to add the code you already have and see when it breaks.
Refer to examples/tutorials found by googling if you aren't getting that minimal example to work


Yea i tried getting that minimal example stuff already so ill google some stuff


does the elif need to be aligned with the "if?" In the tree above that, your first elif is aligned with your "if," and then the subsequent indentations are made.

Sorry, I'm new to Python, but thought I'd see if I could help.


You good man. I tried that and it actually did work and the error moved to a different line but then i got another different error so yeah. But ur suggestion actually did work.


@netanemo, I used ur code and it works. I dunno whats happening to ur pc


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