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) Shopping List Lists and Strings

I need help

Create a variable named greeting_list that's the string "Hi, I'm X" split on the spaces.

My answer: greeting_list = ["Hi, I'm X"]

Am getting error!

Thanks

3 Answers

Thanks for your help.

it worked. I did : greeting="Hi, I'm{}".format('my first name')

Am really new to programming. Again, Thanks for your help.

Jordan Anderson
Jordan Anderson
19,560 Points

It was my pleasure. I'm fairly new to the more programming side myself.

I think python is a great place for you to start! I've only done a little bit of it myself. But it has very simple, clean, and terse syntax. I believe it'll be a great way for you to break into programming and learning object oriented programming.

Best of luck!

Jordan Anderson
Jordan Anderson
19,560 Points

Hey Hussein,

The 'X' can be any name you want. You do not actually need the '[]'. And you also for got to use the dot syntax and call the split function.

greeting_list = "Hi, I'm Jordan".split()

I don't understand this question too: Lastly, change the "X" in greeting_list to the first item in your name_list variable. Then join this list back into a string and store it in the variable greeting. You should end up with "Hi, I'm <your first name>".

Is it asking I should write another variable or what?

Thanks for your help.

Jordan Anderson
Jordan Anderson
19,560 Points

Yes it is. I thought it was kind of a vague question at first too.

Its asking you do to all that stuff in a new variable : greeting = "Hi, I'm......."

I'll give you a chance to figure out the rest before I spill the answer :) . Here's a hint tho, you need use" {}"

Hope this helps

Best of Luck

This what i got :Your name_list's first item doesn't seem to be in your greeting!

my answer: greeting="Hi, I'm {}"

Jordan Anderson
Jordan Anderson
19,560 Points

You have to format {}. -> greeting = "Hi, I'm {}".fomat(some code in here)