7. Plan your trip


Hi Guys, please help!
I don't know what I've done wrong :frowning:

Its saying "nothing is printing to console"

def hotel_cost(nights):
    return 140 * nights
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 -= int(50)
    elif days >= 3 and days <= 7:
        cost -= int(20)
    return cost
def trip_cost(city, days, spending_money):
    return plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days) + spending_money
    print trip_cost("Los Angeles", '5', '600')


i just got finish with this, so i'd like to help others now as i ask for help to others also..

your code in print was a bit off because you make '5' and '600' a string... that should be left int.
print trip_cost("Los Angeles", '5', '600')

("Los Angeles", 5, 600)


Hi there,

I just tried these changes but still getting "nothing was printed to console" :frowning:


are you calling do it like this?

print ("Los Angeles", 5, 600)

or were you just typing
("Los Angeles", 5, 600) ?

You need to use the first example with print before it.


Can anyone point out my errors here?


I was stuck on this problem for an hour. Just figured it out print must be aligned to the left not indented.


Thank you very much.


Hi @nrgwood,

Hint: Your print statement should be outside the trip_cost function.


2 posts were split to a new topic: Unsupported operand type(s) for +: 'NoneType' and 'int' Exercise 7


I don't understand. What do you mean aligned to the left?


Can you post an image of your code please?


Thank you very much. Took me over 2 hours and only when I saw your comment I realized what I was doing wrong. The solution was so simple the print command is a new command and not pat of the trip_cost function.
Noticed that problems often occur due to wrong indentation.


@labibsharrar @thorshammer76 means that the print statement should be outside the trip_cost function. By indenting it to the right, you move it inside the trip_cost function. By indenting it to the left, you move it outside the trip_cost function.


Thank you for posting this. I had the same problem and thankfully found your explanation within minutes of making the mistake.


3 posts were split to a new topic: Plan your trip