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.

Python

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
215,956 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