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

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,862 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.