Taking a Vacation Error


def hotel_cost(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):
    cost = days * 40
    if days>=7:
        return cost - 50
    elif days>=3:
        return cost - 20
    return cost
def trip_cost(city, days):
    return hotel_cost(days) + plane_ride_cost(city) + "\n"
I keep getting this error: Oops, try again. trip_cost('Tampa', 3) raised an error: unsupported operand type(s) for +: 'int' and 'str'


if you want to break code to next line, just use \, "\n" is for strings


I just tried that, I'm getting this error though:
File "python", line 20
return hotel_cost(days) + plane_ride_cost(city) `,
SyntaxError: unexpected character after line continuation character
Btw thanks for quick reply


you need to use backslash to move code to the next line, sorry, markup got mixed up given the backslash escaped the character i used for markup :stuck_out_tongue:


Got it, just worked. Thanks!


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