Taking a Vacation: Something is Wrong with my Code


#1

hey if anyone can help it would be awesome ... it says {Oops, try again. trip_cost('Tampa', 4) returned 364 instead of the correct value 920}

def hotel_cost(nights):
# hotelcosts=140pernight
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):
price = 40 * days
if days >= 7:
price -= 50
elif days >= 3:
price -= 20
return price'''
def rental_car_cost(days):
price = 40 * days
if days >= 7:
price -= 50
elif days >= 3 and days <= 6:
price -= 20
return price
def trip_cost(city,days):
return rental_car_cost(days) + plane_ride_cost(city) + days


Yoohoo! can anyone help me! something is wrong with my code!
#2

This is incorrect ...

def trip_cost(city,days):
    return rental_car_cost(days) + plane_ride_cost(city) + days

You are adding in days instead of hotel_cost(days).


#3

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