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 trial

Python Python Basics All Together Now Cleaner Code Through Refactoring

Confused on function

For this function here. What does "number_of_ticket" represent? It's no where in the while loop so how would it know what number_of_tickets even is? While loop only has num_tickets

def calculate_price(number_of_tickets): #Create a new constant for the 2 dollar service charge #Add service charge to what is due return (number_of_tickets * TICKET_PRICE) + SERVICE_CHARGE

1 Answer

Xavier Bass
PLUS
Xavier Bass
Courses Plus Student 2,246 Points

number_of_tickets is the parameter of the function for when you call the function and pass in an argument ...so number_of_tickes is what you put in like ...calculate_price(5) (five = number_of_tickes... basically its a placeholder )