I don't understand what's wrong with my code


#1

I don’t understand why my code isn’t working

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 “Wrong City”

def rental_car_cost(days):
if days >= 7:
return days * 40 - 50
elif days >= 3:
return days * 40 - 30
else:
return days * 40


#2

Try using lowercase on the variable name so it matches the instructions. There should not be an else clause on that if statement. If the city is not found, the function will not return anything, so None will be the result.

That should be -20, not -30.


#3

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