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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![kelsang sherab](https://secure.gravatar.com/avatar/0431cca5823477473f5be3c114b8a400?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
kelsang sherab
749 PointsWhat is the meaning and purpose of 'literals' ??
I am trying to understand the meaning of the word literal as in string literal list literal numeric literal etc
So i have read various explanations online but I don't get it. I do not understand what does "notations for constant values of some built-in types" actually mean? What would a programing world look like if we did not have the concept of literals?
1 Answer
![Cooper Runstein](https://secure.gravatar.com/avatar/51849faf72df0677b8256b043707e287?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Cooper Runstein
11,850 PointsLiterals are best discussed in comparison to variables:
my_variable = 1 # this is a variable
1 # this is a literal
A variable can store data, and that data can change, while a literal is constant, like 1 or 'hello', you can't change these because they would no longer be themselves. Imagine if everything were explicit variables:
#Normal
my_list = [1,2,3]
one = 1
for x in my_list:
return x += one
By not having to save 1 as a variable one, we can save a line of code. In this small example, that's not a big deal, but if we can save one extra line for every five lines of code we write, that adds up quickly.
kelsang sherab
749 Pointskelsang sherab
749 PointsThanks Cooper!! Great answer.