5/7 badly stuck


def hotel_cost(nights):
cost_nights = nights * 140
return cost_nights

def plane_ride_cost(city):
city = city.lower
if city == "Charlotte":
return "183"
elif city == "Tampa":
return "220"
elif city == "Pittsburgh":
return "222"
elif city == "Los Angeles":
return "475"
else :
return "none"

def rental_car_cost(days):
cost = 40 * days
if days >= 7:
cost -= 50
elif days >= 3:
cost -=20
return cost
print (rental_car_cost(6))

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

it says Oops, try again. plane_ride_cost('Charlotte') returned 'none' instead of the correct value 183


Remember to paste your code with indentation. Use three backticks/backquotes before and after your code.

However in your case I think issue might be cause of this

After removing capitalization you compare city with city name which has capitalization.


Hi @systemace80996 ,

You have this ...

city = city.lower

Thereafter, city will not match any of the names of cities in the if structure, because they all begin with an uppercase letter.


i dont understand what you people are saying, when i removed this city.lower line, issue remain the same.


Hi @systemace80996 ,

Another problem is that you are returning strings, as follows ...

return "183"

Instead, return a number ...

return 183