Pulling it together



File "python", line 22
def trip_cost('Tampa',8):
SyntaxError: invalid syntax

they are saying that a single quote

def hotel_cost(days):
    return 140 * days
def plane_ride_cost(city):
    if city == "Charlotte":
        return 183
    elif city == "Tampa":
       return 220
    elif city == "Pittsburgh":
        return 222
        return 475

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

def trip_cost('Tampa',8):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)


The arguments for the trip_cost function don't need to be passed through yet. Try this instead:

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


ok i'll try that thanks


thanks so much i've been struggling for ages and kept on thinking that it was wrong


can someone help me my code is a little off but im not sure whats wrong. thanks!

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


This discussion is to help @acodster

I would be happy to answer your question, @bushmonkey09 , however you need to first make a new topic and post your discussion there.


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