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

Austin Jimison
Austin Jimison
3,849 Points

tried adding a counter but says int is not iterable

confused

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

2 Answers

Steven Parker
Steven Parker
231,275 Points

I get a different message when I try it: Bummer! Didn't find all the "Hello"s.

The problem isn't the loop, but you need to add a space in front of the word " World" so that the two words won't run together when concatenated in the print statement.

Idan shami
Idan shami
13,251 Points

Hi Austin! you were very close all you need is to add a space before "World" like this:

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

because if you will not add a space it will turn out like this : "HelloWorld"