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 Gather Information

livia salgado
livia salgado
4,407 Points


is there any reason why at the beginning we hace TICKET PRICE in capital letters? thanks!

3 Answers

TICKET_PRICE is in caps to emphasis the fact that the value isn't meant to be changed. You can still change the value, of course, and Python wouldn't even complain, but it is a message for the programmer saying, "Do not change the value of this variable!!"

In other languages, like Ruby, if a variable is in ALL CAPS, and you attempt to change the value, it would either cause an error or cause a warning. But Python is friendlier :)

Stuart Wright
Stuart Wright
41,118 Points

There is no technical reason, but it is a convention in Python to choose upper case variable names for constants (values which will not be changed at any point in our program). It makes it easier for other programmers looking at your code to know that this value is a constant.