7. Plan Your Trip!


#1
1   def hotel_cost(days):
2       return 140*days
3    
4   def plane_ride_cost(city):
5       if city == "Charlotte":
6           return 183
7       elif city == "Tampa":
8           return 220
9       elif city == "Pittsburgh":
10           return 222
11       elif city == "Los Angeles":
12           return 475
13        
14   def rental_car_cost(days):
15       if days >= 7:
16           return (days*40) - 50
17       elif days >= 3 and days < 7:
18           return (days*40) - 20
19       else:
20           return days * 40
21        
22   def trip_cost(city, days, spending_money):
23       return plane_ride_cost(city) + hotel_cost(days) + rental_car_cost(days) + spending_money
24   print trip_cost ("Lost Angeles", 5, 600)

this is the error message
Traceback (most recent call last):
File "python", line 24, in
File "python", line 23, in trip_cost
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'


#2

Look at line 24. It should mean "Los Angeles" not "Lost Angeles". A basic typing error here.


#3

my eyes failed me!

does this mean that i will not be good in debugging?


#4

No. That's a usual matter in the world of programming...