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)
![Jamshaid Ali](https://secure.gravatar.com/avatar/3333c622f68b66f8c6c1a90904ca5120?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jamshaid Ali
189 PointsWhat are the comma's used for i didnt quite understand there usage? Video : (Variables Python )
WHat are the commas usd for in python when writing a variable or using strings.
1 Answer
![Peter Vann](https://uploads.teamtreehouse.com/production/profile-photos/8935412/micro_MaiTaiPeteGravatar.jpg)
Peter Vann
36,426 PointsCommas used inside the print statement allow you to concatenate smaller strings (text tidbits, essentially) into one long string. In that new string, wherever the comma appears, it is replaced automatically by a space (" "). This concatenation ability allows you to also insert (the values of) variables into that long string.
Consider this code snippet:
full_name = "Jamshaid Ali"
language = "Python"
print(full_name, "is well on the way to being a", language, "guru!")
will print:
Jamshaid Ali is well on the way to being a Python guru!
You can also achieve the same result this way:
full_name = "Jamshaid Ali"
language = "Python"
print(full_name + " is well on the way to being a " + language + " guru!")
Notice that if you concatenate with the + you need to add the spaces to the text. Using the comma, you don't.
You can play with it here:
https://www.katacoda.com/courses/python/playground
More info:
https://www.programiz.com/python-programming/methods/built-in/print
Bonus (other ways to do similar things):
https://www.programiz.com/python-programming/string-interpolation
I hope that helps. Happy coding!