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

why does it keep telling me it can't find all the Hellos?

After searching I'm sure this should be right although, I know I could still be wrong.

The issue I'm having is, it keeps saying it can't find all the hellos...

When I remade the helloS list it said i can't do that so I'm really confused as to what is wrong.

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

1 Answer

stjarnan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
stjarnan
Front End Web Development Techdegree Graduate 56,488 Points

Hi Alexander,

You're writing a loop that stores the items in hellos in a new variable called hello, when you later inside that loop want to use the data you're looping through, you want to use your hello variable as this is the one storing each hello. Does that make sense to you?

Good luck,

Jonas

The moment you said about the new variable being hello opposed to hellos list i just face palmed! Edited too:

for hello in hellos:

print("{} world".format(hello))

Thank you for a fast easy to understand response!

Owe you one!