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 trialNeil Archambault
1,838 Pointsfor loops
can't figure it out
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好" ]
for words in hellos:
print('word' + 'World')
3 Answers
Neil Archambault
1,838 PointsI figured it out, I was missing the space before the word world.
jcorum
71,830 PointsNeil, you're very close:
for hello in hellos:
print(hello + " world")
Here I use hello for the variable. You create words but never use it. You probably meant to have words instead of word here: print('word' + 'World'), instead of 'word'. Note that you cannot quote the loop variable, even when you spell it right.
Josh Roberts
9,930 PointsYou are using "words" and then printing 'word'. Change words to word and remove the ' from the 'word' in print to print the variable instead of 'word'
for word in hellos:
print(word + 'World')
Neil Archambault
1,838 PointsNeil Archambault
1,838 Pointsand the s on words.