I wanted to add some features to the final code - to make it so, that you could enter a number of days to stay, city and money to spend from keyboard, rather then use fixed values. I thought my previous learning from the course would be enough for this, but apparently, I got stuck.
Traceback (most recent call last):
File "python", line 35, in
File "python", line 28, in trip_cost
File "python", line 20, in rental_car_cost
TypeError: unsupported operand type(s) for -: 'unicode' and 'int'
Instead, I expect to enter 3 values from keyboard, and get a calculated total sum to spend
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 else: print "Choose a city we can provide a flight to" def rental_car_cost (days): if days < 3: return 40 * days elif days > 6: return 40 * days - 50 else: return 40 * days - 20 def cash_to_spend(spending_money): return spending_money def trip_cost (city, days, spending_money): return rental_car_cost (days) + hotel_cost (days) + plane_ride_cost (city) + cash_to_spend(spending_money) n = input("Enter a number of days you'd like to stay in a hotel: ") m = raw_input("Enter a city you'd like to fly to: ") p = input("Enter an ammount of cash you'd like to spend on your vacation: ") print trip_cost(n, m, p)