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

Create a loop for a list, and to the strings add a string "world"

I've been fighting this for two days, i started reading a book to get a better feel for python, and I even redid the previous courses up to this point. I still am at a lost, I know its simple, like i'm starting to think {} needs to be added in the variable hellos, than .format(world). I don't understand, how I went through 4 chapters in a python book, did the course on here, redid the course. N still kind of like ugh..

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

1 Answer

for items in hellos: # creates a foor loop
    print(items) # print out the items from the list, in the challenge you do not need this line of code
    print(items + " World") # print out a string with the items from the list and the string " World"