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!

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


Nicolas Bassano
Nicolas Bassano
2,125 Points

Python Basics - Naming things // Sintax question

I doing the Python Basics and got to the "Naming Things" video.

At 01:58 Kenneth writes down:

favourite_fruit = "apple"
favorite_number = 42

Why is it that the 42 doesnt have quote marks?

Like...................favorite_number = "42"

Sorry but english is my second language :P

1 Answer

Steven Parker
Steven Parker
227,114 Points

:point_right: The difference is the type of variable:

first_number = 42    # <-- this variable is a number
other_number = "42"  # <-- this variable is a string

The first one can be used later for math, the second one could not (without conversion).

Nicolas Bassano
Nicolas Bassano
2,125 Points

Aha, I get it.

Thanks a lot Steven