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 trial

Python Python Basics (2015) Logic in Python Loop

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".

Does anybody know how to solve this question?

loop.py
hellos = [
    "Hello",
    "Tungjatjeta",
    "Grüßgott",
    "Вiтаю",
    "dobrý den",
    "hyvää päivää",
    "你好",
    "早上好"
]
for language in hellos:
    print(hellos + [" world "])

Your output should be a list that starts with "Hello World" and ends with ""早上好 World". You are starting your loop correct but you need to think about which item you begin your print with. To help you visualize it better, change the name of the variable language to each_word. Then it reads for each word in hellos: That should help you see more clearly how to then get "Hello world". Also take a look again at how to build a string by adding another string.

Thank you. I solved the problem.