Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialgrantcenter
8,421 PointsQuestion on calling the service charge function
I had almost everything right in my code except i was originally calling the function like:
amount_due = calculate_price
instead of:
amount_due = calculate_price(number_of_tickets)
I guess my question is why do you have to include the (number_of_tickets) part when calling the function? Is that actually a part of the function name? Just a little confused because earlier it felt like that was just a placeholder
1 Answer
Steven Parker
231,198 PointsThe "number_of_tickets" is what is known as an argument to the function. The function uses this value to compute the amount. It is the value of the argument that is assigned to the parameter, which is the placeholder that was used in the function definition.
And FYI: even when a function doesn't need any arguments, you still must put parentheses after the name when you call it.