I need help with Taking A Vacation 6/7


#1

I don't know what is wrong with my code.Can you check and give me the right 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):
    cost = 40 * days
    if days >= 7:
        cost -= 50
    elif days >= 3:
        cost -= 20
    return cost
print rental_car_cost

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

Please help!


#2

it would be helpful if you can provide the error message you are recieving.

Not a great idea but you can be guided in debugging your code


#3

is a variable here

but it is being called as a function here


#4

can you tell me more detailed


#5

i'm kinda new to forums


#6

The error message is:
Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Take a look at the console window for the error message from the interpreter.


#7

whats the error message in the console
the parenthesis after spending_money here

means that it is supposed to be some function but it is not. You must remove this ()


#8


Traceback (most recent call last):
File "python", line 25, in
NameError: name 'days' is not defined


#9

this is the console window


#10

it's not helping
it still gives this message in the console
File "python", line 26
return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money
^
IndentationError: unexpected indent


#11

here is the 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):
    cost = 40 * days
    if days >= 7:
        cost -= 50
    elif days >= 3:
        cost -= 20
    return cost
print rental_car_cost

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

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

#12

back to your original code

you defined trip_cost function here

are you trying to use that function here? or overide it here?

if not erase the first trip cost and add def before the second one and : after
like this

def trip_cost(days, city, spending_money):
[indent 4 spaces or one tab] before any statement