Plan your trip exercise -


#1

For the plan your trip exercise i am getting this error

Traceback (most recent call last):
File “python”, line 27, in
File “python”, line 24, in trip_cost
TypeError: unsupported operand type(s) for +: ‘int’ and ‘NoneType’

Please help whats wrong in t

def hotel_cost(nights):
  return 140*nights

def plane_ride_cost(city):
  if city=="Charlotte":
    return 183
  if city == "Tampa":
    return 220
  if city == "Pittsburgh":
    return 222
  if city == "Los Angeles":
    return 475

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

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


print trip_cost("Los Angeles",5,600)

#2

Have you considered what the rental_car_cost will return for 7 days ?


#3

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