Interperter is out of sync with my code


#1



I was working on Putting it all together for Taking a Vacation - Exercise 5. Below is my code:

It is is giving me the following error message:

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

Unfortunately, the interperter seems out of sync with what I have written as there is no reference elif in line 3 as you may note below:

What are my options at this point?

def hotel_cost(nights):
cost = 140 * nights
return cost

def plane_ride_cost(city):

 if plane_ride_cost(city) == "Charlotte":
    cost = 183
    return cost
 elif plane_ride_cost(city) == "Tampa":
    cost = 220
    return cost
 elif plane_ride_cost(city) == "Pittsburgh":
    cost = 222
    return cost
 elif plane_ride_cost(city) == "Los Angeles":
    cost = 475
    return cost

def rental_car_cost(days):

if days >= 7:
    cost = (40 * days) - 50
return cost

elif days >= 3:
    cost = (40 * days) - 20
return cost

else:
    cost = 40 * days
return cost

def trip_cost(city, days):
trip_cost = rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)
return trip_cost


Replace this line with your code.


#2

We can't really tell for sure, but it looks like the return is not indented, so is setting up the error in the next line.


#3

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