#7 Plan Trip cant print out final code on to console


#1

My final code would not print onto the console. i am so confused. Can't figure out what wrong. Help would be appreciated

def hotel_cost(nights):            #hotel cost $140/ night 
    return 140 * nights 
def plane_ride_cost(city):         #diff prices per destin 
    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):       #rental car cost per trip   
     cost = 40*days 
     if days >= 7: 
        cost -=50
     elif days >= 3: 
         cost -=20
     return cost 
def trip_cost(city, days, spending_money): 
    c= rental_car_cost(days)+hotel_cost(days)+plane_ride_cost(city)+spending_money
    return c
    print trip_cost("Los Angeles",5,600)

#2

a function call executes the function, so its should be outside the function content. (hint: indent)


#3

thanks for your reply ! I figured it out before. I appreciate the help :slight_smile:


#5

2 posts were split to a new topic: #7 plan your trip


#6

Hi so i know that ("Los Angles", 5, 600) is the right answer but how does python know which number is for which value? like i originally put 5 * days, but why is it wrong?


#7

arguments and parameters are sequential. so the first arguments ("Los Angles") gets linked to the first parameter (city) and so on


#8

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