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 trialDidier Borel
2,837 Pointsdidn't find all the words in a list
I don't understand why I get this error message-
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for word in hellos:
print("word World")
3 Answers
Jennifer Nordell
Treehouse TeacherI really don't know what to say. Here's the entirety of the code copy/pasted from my passing challenge.
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for word in hellos:
print (word + " World")
Jennifer Nordell
Treehouse TeacherYour for loop isn't doing what you think it's doing. In your current code, the for loop will print this out to the screen "word World" and it will print that 8 times. Exactly those words. What you want is for it to print the word from the hellos list then print "World" afterwards. This is the for loop you're looking for.
for word in hellos:
print (word + " World")
Didier Borel
2,837 PointsJennifer, this for your quick answer, but when I do that. I still get the error message "can't find all the hello's" i don't understand why
Didier Borel
2,837 Pointsit works now! thxs, the problem must have been the indentation after the :
this
gaetano amoroso
2,993 Pointsgaetano amoroso
2,993 PointsHello Didier Borel, great job, you have almost understod.
WORD is an placeholder for each value of the list, you put it out of the quotation marks because is a variable not a litteral