Creating a small user interface to ask for the details of the trip


I am stuck at the end of 7. Plan your trip! Although my code works perfectly fine for a single result, I would like the console to ask the user for the destination, duration and planned spendings of the trip and return the exact cost of the trip.

Howerver, I keep getting this error message
"Traceback (most recent call last):
File "python", line 32, in module
File "python", line 26, in trip_cost
TypeError: unsupported operand type(s) for +: 'int' and 'unicode'" (or 'int' and 'str')

I have tried to change the type of my "spending_money" variable to number so that it can be normally added to the other variables but it fails every time. How could I correct it?

def hotel_cost(nights):
    return 140*nights

def plane_ride_cost(city):
    if city=="charlotte":
        return 183
    elif city=="tampa":
        return 220
    elif city=="los angeles":
        return 475
    elif city=="pittsburgh":
        return 222
def rental_car_cost(days):
    if days >=7:
        return cost
    elif days>=3 and days<7:
        return cost
        return cost
def trip_cost(city, days, spending_money):
    return plane_ride_cost(city) + hotel_cost(days) + rental_car_cost(days) + spending_money

city=raw_input('Where do you want to go?').lower()
days=raw_input('How long do you want to go?')
spending_money=int(raw_input('How much do you want to spend?'))

print trip_cost(city, days, spending_money)

Thank you very much for your help and your time !



why are you not casting the raw_input of your days to a integer? Days should also be numbers, otherwise it is a string, and that gives problem in the rest of your code


Yup that fixes it! Sorry I didn't think of that!

Tank your very much for your help.