Confused why spending_money doesn't have parentheses after


#1



https://www.codecademy.com/en/courses/python-beginner-P5YtY/1/5?curriculum_id=4f89dab3d788890003000096


None.


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


#2

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


#3

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

Thanks


#4

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:


#5

Understood, thanks!!


#6

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