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 trialGregorio Bernabel
3,412 Pointsstuck in this loop. cant get it to print the characters like : "Tungjatjeta", "Tungjatjeta", "Grüßgott", etc
hellos = [ "Hello", "Tungjatjeta", "Grüßgott", "Вiтаю", "dobrý den", "hyvää päivää", "你好", "早上好" ] for words in hellos: print("Hello" + " " + "world")
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for words in hellos:
print("Hello" + " " + "world")
3 Answers
Antonio De Rose
20,885 PointsIf you've been asked to print names like "Hello", "Tungjatjeta", "Grüßgott", "Вiтаю", "dobrý den", "hyvää päivää", "你好", "早上好" and if your print statement, would mention, print("Hello" + " " + "world"), how would it print "Tungjatjeta", "Grüßgott" etc print.
Question - I need you to write a for loop that goes through each of the words
in hellos and prints each word plus the #word "World". So, for example,
the first iteration would print "Hello World".
and it had been mentioned, the first iteration, would print "Hello World", this loop will go through 8 times, as it has 8 strings in the list hellos. 1st time - "Hello World" 2nd time - ""Tungjatjeta World" 8th time - "早上好"
give it a last try
# You have got the for loop done - correct
# prints each word - wrong (think what should come in place of "Hello")
# plus the World - correct
for words in hellos:
# just think, what would this variable words would have, in the right above line
Elad Ohana
24,456 PointsHi Greg,
Your statement will print "Hello world" 8 times, but maybe it's not "Hello" that you want to print, but, something else instead of hello, so you really want "<insert something here> world"... Take a second look!
Antonio De Rose
20,885 PointsYes, just as Elad mentioned, you have to insert something instead of "Hello", your almost there, good luck, your approach is correct, just try to understand the question another time and try it.
print("Hello" + " " + "world")#"Hello" needs to be replaced.
Gregorio Bernabel
3,412 Pointsokay, i am trying been on it for a few hours