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

How do you create a variable using strings?

It does not explain how to do this in the video before this set of tasks.

name.py
name = "Adam"
treehouse = 

1 Answer

Hi Charles,

The first line of your code is a variable declaration for 'name' which contains the string 'Adam'. So to assign a string to the 'treehouse' variable, you would simply enter a string of characters contained inside quotes to the right of the equal sign like this:

treehouse = "Some string value"

So now treehouse contains the string "Some string value"

Hope this helps, you can read a bit about Python variables here

Thanks!