Taking a vacation / 4.Transportation


#1



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


Replace this line with your code. 

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

it says Oops, try again. It looks like rental_car_cost returns 120 instead of the correct amount (100) for 3 days.
i don't know what is wrong


#2

never mind figure it out :sweat_smile:


#3

Olá, tente o seguinte:
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 "Digite outra cidade"

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


#4

my code:

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

my error message:

Oops, try again. It looks like rental_car_cost returns -10 instead of the correct amount (40) for 1 days.

what am i doing wrong??


#5

never mind. I've got it


#7

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