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 (Retired) Ins & Outs Ins & Outs

Creating a variable

... why in the video Kenneth imputes If name == "Kenneth": but in the challenge task 1 of 3 when i input If name == "Cameron": it says the == marks are wrong. please fix this because this is unacceptable. If i am doing the exact same thing as what i was teached and it doesn't work, its not my my fault its the challenge task. FIX IT.

1 Answer

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello Cameron,

The double == is an equality operator. Assignments in Python are always a single =.

So it is correct to check if a variable is equal to a certain value, say to check if a variable named "key" is equal to the string "C#", it would be:

if key == "C#":
    ...
else:
    ...

Assigning a value to a variable would be:

key = "C#";

I hope that helps.