Hey, You Never Know!


#1

Can someone help me, I'm stuck because i can't figure out how to add the spenidng money to my trip cost and i can't really see what I'm doing wrong. It says that the global name 'speniding_money' is not defined


def hotel_cost(nights):
    return 140*nights
def plane_ride_cost(city):
    if city=="Charlotte":
        return 183
    if city == "Tampa":
        return 220
    if city == "Pittsburgh":
        return 222
    if city == "Los Angeles":
        return 475
def rental_car_cost(days):
    rent=days*40
    if days>=7:
        return rent-50
    elif days>=3:
        return rent-20
    return rent

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


#2

why create a function for spending money? Its not needed

Make sure you spell spending_money correctly everywhere


#4

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