Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Drew O'ConnellCourses Plus Student 726 Points
Instead of defining calculate_price and adding in the service charge, couldn't you have just left everything else the same but made the amount_due=((num_tickets*TICKET_PRICE)+2)? It just seems a lot easier to do it that way, so I don't understand why he went through all the trouble of defining at the top
By making the SERVICE_CHARGE a constant it's easy to change it later if you need to. You have to do it only in one place. If you hardcode the service charge everywhere in the code and you have a bigger program it's really time-consuming to find all the places where you have the service charge if you need to change it. The function calculate_price is also reusable and you can use it easily anywhere in the code. I hope this makes sense?