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 trialSirui Ma
1,371 PointsI can only print English hellos, for other hello in different languages, it will give me messy code. Does anyone know?
I can only print English hellos, for other hello in different languages, it will give me messy code. Does anyone know how to fix this?
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
print ("Hello World")
print ("Tungjatjeta World")
print ("Grüßgott World")
2 Answers
Jerehme Gayle
5,206 PointsHello Sirui Ma,
The challenge is asking you to loop through hellos using a for loop and print each form of hello plus world. So you will need a for loop, a print function, and to concatenate ' World'.
The for loop should look similar to this
for x in values:
print()
SPOILER
Below is the code that passed for me
for hello in hellos:
print(hello + ' World')
Happy Coding
Jason Anders
Treehouse Moderator 145,860 PointsHi Sirui,
This challenge is asking for you:
to write a for loop that goes through each of the words in hellos and prints each word plus the word "World".
The code above is just hard-coding in the print statements, but what happens if you have 10000 hellos to print? This is where the loop come in. I recommend that you review this video and then give the challenge another go.
Keep Coding! :)