Plan your trip!


#1



Oops! Did you accidentally delete the trip_cost function?


Replace this line with your code. 
def hotel_costs(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):
    rental_cost = 40*days
    if days >= 7:
        return 40*days-50
    elif days >= 3:
        return 40*days-20
    else:
        return rental_cost
        
def trip_cost(city,days,spending_money):
        return rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days) + spending_money
        print trip_cost("Los Angeles", 5_days, 600)


#2

This line appears inside the block of the function. It should be in global scope with no indent.


#3

still getting an error`
def hotel_costs(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):
rental_cost = 40*days
if days >= 7:
return 40*days-50
elif days >= 3:
return 40*days-20
else:
return rental_cost

def trip_cost(city,days,spending_money):
return rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days) + spending_money
print trip_cost("Los Angeles", 5_days, 600)
`

File "python", line 27
print trip_cost("Los Angeles", 5_days, 600)
^
IndentationError: unindent does not match any outer indentation level


#4

There is still some indentation on that line. Remove all indentation.


#5

def hotel_costs(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):
rental_cost = 40*days
if days >= 7:
return 40*days-50
elif days >= 3:
return 40*days-20
else:
return rental_cost

def trip_cost(city,days,spending_money):
return rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days) + spending_money
print trip_cost("Los Angeles", 5_days, 600)

File "python", line 27
print trip_cost("Los Angeles", 5_days, 600)
^
SyntaxError: invalid syntax


#6

there is a typo in one of your functions, look closely at the spelling


#7

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