Oops, try again. It looks like plane_ride_cost does not return 222 when the city is Pittsburgh


#1

No matter how much I try, it reads the same error. I check for the indentation but it still doesn't work. I'll be glad if you can help me. Thank you!

def hotel_cost(nights):
    return 140 * nights
    
def plane_ride_cost(city):
    if city == "Charlotte":
        return 183
    elif city == "Tampa":
        return 220
    elif city == "Pittsburg":
        return 222
    elif city == "Los Angeles":
        return 475

#2

try this
def hotel_cost(days):
return 140 * days

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

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


#3

Hey! Thanks a lot.

I tired that but it still read indentation error but clearing that up. It works! Thanks for the help. :slight_smile:

Just wondering, I still wonder what mistake had i made? I see no difference between the code. Please let me know in your free time.


#4

send me the whole code and then i'll tell you. Maybe after my SA1 (26th sept).


#5

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