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

Drew Rollins
Drew Rollins
694 Points

Stuck on for loop challenge in python

I'm not sure what I'm doing wrong here. I get the response "Didn't find all the hello's" here is my code. Thank you!

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

2 Answers

Michael Olszewski
Michael Olszewski
2,513 Points

This work for me:

for s in hellos:
            print(s + ' World')

I believe this will yield your desired results:

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

Drew Rollins
Drew Rollins
694 Points

Thank you. That worked!

Daniel Glover
Daniel Glover
1,782 Points

How did you come to decide using the_hellos ? I tried so many variations of words and ended up going for a plural (of the already plural-named variable), which was helloss. Felt so wrong, but worked.