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

Nicholas Blocher
Nicholas Blocher
5,848 Points

The following code works, I checked it in python on my computer but for some reason I can't continue with the challenge?

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

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

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Nicholas,

Not sure how the code is working on your computer. As written, your code will never print anything (and if it did, it would print the wrong thing). This line:

greeting + " World"

has no assignment, so you are never adding " World" to the greeting variable. Then you have continue which ends the current cycle of the loop and starts the next cycle before your print statement which means that your print statement will never be called.