Taking a vacation pulling it together


#1

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
else:
    return False
def rental_car_cost(days):
amount = 40 * days
if days >= 7:
amount -= 50
elif days >= 3:
amount -= 20
    return amount
print rental_car_cost
def trip_cost(city, days):
    return rental_car_cost(days) + hotel_cost(nights) + plane_ride_cost(city)

#2

just will not compile

maybe just indentation?


#3

python is an interpreted language

yea, its indention. The indention is really off, at many places


#4

def hotel_cost(nights):
    return nights * 140
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
else:
    return False
def rental_car_cost(days):
    amount = 40 * days
if days >= 7:
    amount -= 50
elif days >= 3:
    amount -= 20
    return amount
print rental_car_cost
def trip_cost(city, days):
    return rental_car_cost(days) + hotel_cost(nights) + plane_ride_cost(city)

error message reads File "python", line 6
elif city == "Tampa":
^
SyntaxError: invalid syntax


#5

I still am unable to tell with the wall of text you made. Try to use markdowns to be able to see clearly (like @stetim94 did for your first post). I would recommend you to take a look here to learn more about using markdowns. @stetim94 is correct about the indentations found in the code you made. Remember, after the colon :, there should be indentations.


#6

he didn't, i did actually. The indention is now visible


#7

I didn't know you had the ability to go in and apply it. That's great! Sorry for not giving you credit. I give you credit now!


#8

but please, feel free to tell where @alike44 went wrong and what he needs to improve :slight_smile: