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 trialhbydjvnabd
525 PointsDidn't find all the Helloss ?? hellos = [ "Hello", "Tungjatjeta", "Grüßgott", "Вiтаю", "dob
hellos = [ "Hello", "Tungjatjeta", "Grüßgott", "Вiтаю", "dobrý den", "hyvää päivää", "你好", "早上好" ]
for language in ["Hello","Tungjatjeta","Grüßgott","Вiтаю","dobrý den","hyvää päivää","你好","早上好"]: print(language + "World")
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for language in ["Hello","Tungjatjeta","Grüßgott","Вiтаю","dobrý den","hyvää päivää","你好","早上好"]:
print(language + "World")
2 Answers
Alexander Davison
65,469 PointsFirst of all, the reason that the hellos
variable is created is because the challenge wanted you to use it... Not for you to copy-and-paste.
Instead of writing the array all over again, you could just reference to the value of the hellos
variable.
Also, Python does exactly what you say, so the output will be:
HelloWorld
TungjatjetaWorld
GrüßgottWorld
ВiтаюWorld
dobrý denWorld
hyvää päivääWorld
你好World
早上好World
And, of course, the challenge is expecting a space between whatever the hello is and the "World" part.
You actually have to add that explicitly.
If you fix both problems, you should end up with this:
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for hello in hellos:
print(hello+ " World")
I hope you understand.
Good luck!
~Alex
hbydjvnabd
525 Pointstks ;)
Alexander Davison
65,469 PointsNo problem.
Can you please give a best answer so the answer appears as 'Answered' in the Forum? Thanks.
It might help with the ordering in the forum (maybe in the future?), too.
Thanks again. ;)