Need Help! No printing of output. 7/7


#1

My Code:

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):
total=40*days

if days<3 and days>0:
   return total
elif days>=7:
    total-=50
elif days>=3:
    total-=20

return total

def extra_cost(spending_money):
return spending_money

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

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


#2

most of its right but for the def rental_car_cost(days): the if statements should be highest to lowest like so.

if days >= 7:
    return total - 50
elif days >= 3:
    return total - 20
else:
    return total

Also you have an extra def so just delete the

def extra_cost(spending_money):
    return spending_money

also change the return function from +extra_cost(spending_money) to +spending_money
you dont need a def for this because you set the cost in the print function so it doesnt need to grab it from anywhere

Here is my code if that didnt make sense

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

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

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