Transportation help and explanation please


#1



https://www.codecademy.com/courses/python-beginner-P5YtY/1/3?curriculum_id=4f89dab3d788890003000096#


Oops, try again. Did you create a function called rental_car_cost?


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 "Error"
   
    def rental_car_cost(days):
        cost = 40 * days
        if days >= 7:  
            cost == days * 40 - 50
        elif days >= 3:
            cost == days * 40 - 20
        else:
            cost == days * 40
        return cost


#2

I recommend to look again at lesson "Phyton Syntax 5-7"


#3

I sucsseded to pass this level by building a diffrent function. but I will still love for an explanation whats wrong here....


#4

Hi, I am stuck in this too. What is the different function you built?

Greetings from Germany :slight_smile:


#5

your nested rental_car_cost inside your plane_ride_cost function, rental_car_cost should be outside/after your plane_ride_cost function


#8

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