Why can i pass the quest just for changing the position of the argument?


def hotel_cost(days):
    return 140*days
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):
    if days>=7:
    elif days<7 and days>=3:
    return costs
def trip_cost(days,city):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)

above I get the error message:
trip_cost('Charlotte', 2) raised an error: unsupported operand type(s) for -=: 'str' and 'int'
but when i change the def trip_cost(days,city) into def trip_cost(city,days)
,i pass the quest
i want to know the reason.


unnamed parameters (which you have) have to be in the right order/sequence. How else does the function call now which arguments belong to which parameter?


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