Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
220,450 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"