Confused why spending_money doesn't have parentheses after



Confused why does spending_money does not have parentheses after?
I thought I had to define an argument for spending_money.
def spending_money(money):
return money

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):
    cost = days * 40
    if days >= 7:
        cost -= 50
    elif days >= 3:
        cost -= 20
    return cost
def trip_cost(city, days, spending_money):
    return plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days) + spending_money


spending_money is not a function, Its a value.
The amount of money.


Does it have to be 'spending_money' or could it have just been easily 'money'?



As its a variable ,It can be of any name.
It's just a name , spending_money is more descriptive than money, right ? (using any will not make python angry :slight_smile: )
We prefer descriptive names over short names.
It helps us in long run when we check our code again. :slight_smile:


Understood, thanks!!


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