Help!


#1



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

def hotel_cost(night):
    return 140*night
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):
    if days>6:
        return days*40-50
    elif days>2:
        return days*40-20
    else:
        return days*40
def trip_cost (city,days):
    def trip_cost(city, days,spending_money):
    return hotel_cost(nights) + plane_ride_cost(city) + rental_car_cost(days)     
    print trip_cost

The error is Preformatted text File "python", line 21
return hotel_cost(nights) + plane_ride_cost(city) + rental_car_cost(days)
^
IndentationError: expected an indented block


#2

The instructions say to use nights but this is not an exception, only a mistyped instruction. Still works fine.

Needs to read, hotel_cost(days) ...

Move spending_money up to the first line and remove the second line.

The above will not print what you expect. Print a call to the function.

print trip_cost("Los Angeles", 5, 600)

#3

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