Transportation


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/taking-a-vacation/exercises/transportation-?action=lesson_resume&link_content_target=interstitial_lesson

<In what way does your code behave incorrectly? Include ALL error messages.>
It keeps asking:
Did you create a function called rental_car_cost?

<What do you expect to happen instead?>
Any ideas?


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 - 50
    
    elif days >= 3:
      cost - 20
      
    return cost

#2

the rental_car_cost is part of/nested inside the plane_ride_cost function, why?

Below your existing code is what the instructions say about this


#3

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