Python 4.Transportation


#1

https://www.codecademy.com/courses/learn-python/lessons/taking-a-vacation/exercises/transportation-?action=lesson_resume

It looks like rental_car_cost returns 1 instead of the correct amount (40) for 1 days.

What I expected to happen was it was going to return the right way.

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 or days >= 7:
    return days - 50
  elif days == 3 or days >= 2 and days <= 7:
    return days - 20
  elif days == 1 or days <= 3:
    return days

#2

you need to return the cost of renting a car, not the numbers of days a car is rented


#3

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