Taking a Vacation - Transportation


#1


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

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)
        else:
            if plane_ride_cost("Tampa"):
                return (220)
            else:
                if plane_ride_cost("Pittsburgh"):
                    return (222)
                else:
                    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


#2

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


#3

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


#4

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.


#5

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.


#8

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


#9

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