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

Frank Escamilla
Frank Escamilla
776 Points

I can't seem to get past this Challenge, though the line of code I give it does appear to be correct

I'm getting an error when I check my code that indicates "Bummer! Didn't find all the "Hello"s, however when I run this it does print all the greetings:

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

Any idea how I can get past this?

Thanks!

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

2 Answers

now you need a space.

for word in hellos: 
    print(word + " World")   # add space before World no comma.
Steven Parker
Steven Parker
230,995 Points

The challenges can be very particular about answer format. Remember the example it gave?

So, for example, the first iteration would print "Hello World".

:point_right: Note that the challenge did not ask for a comma separator.

Remove the comma and you should be good.

Frank Escamilla
Frank Escamilla
776 Points

Thanks! However, this is still failing:

for word in hellos: print(word + "World")