Pull it Together


#1

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

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

Oops, try again. trip_cost('Pittsburgh', 5) raised an error: cannot concatenate 'str' and 'NoneType' objects

HELP ,What's the matter?


#2

I can't help you if I can't see your code.


#3

could you see my code now?


#4

This might be a syntax error if so, I'm going to need you to post your formatted code. If you don't know how to format code in your posts, please refer to:


#5

oh dear my,it must be a bug.the codes must be def trip_cost(city,days):,not def trip_cost(days,city):.thx all the same.


#6

It's not so much a bug, as it's just Codecademy's SCT being picky.


#7

You are so nice,thank you!


#8

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