Transportation


#1

Hi everyone,

this is my code:

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

I keep getting this message

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


#2

Perhaps testing if it does what it should is a good idea.


#3

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


#4

cant get this too work !!! any help


#5

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

Hope this helps! If not, reset your code and try it again:)


#6

whats is wrong with this one?


#7

my solution


#8

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