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

Carole Cox
Carole Cox
429 Points

Stumped again...

I get the message "Didn't find all the hellos". Not sure what that means. My code LOOKS good but...

loop.py
hellos = [
    "Hello",
    "Tungjatjeta",
    "Grüßgott",
    "Вiтаю",
    "dobrý den",
    "hyvää päivää",
    "你好",
    "早上好"
]

for word in hellos:
  print ("word + World")

3 Answers

Carlos Alberto Del Cueto Carrejo
Carlos Alberto Del Cueto Carrejo
13,817 Points

World becomes undefined because there is no variable named World this is the statement you should use: print (word +" World") change it and put it instead of your last line. And don't worry, actually python is a really good language and it's good that you are caring enough to ask. ;) paste the line in your code, tell me what result you get, and if you have any doubts as to why it did work or not don't be shy and ask again

Carlos Alberto Del Cueto Carrejo
Carlos Alberto Del Cueto Carrejo
13,817 Points

on your print statement, your word is quoted, making it a string and not the variable word ;) you need word , not " word "

Carole Cox
Carole Cox
429 Points

I still get the same message. I had word not in quotes and World in quotes. If I take World out of quotes, it become undefined? Hmm. Thank you for your time!

Carole Cox
Carole Cox
429 Points

You have been great help! I actually just got through several challenges without any help! Yeah me!

Carlos Alberto Del Cueto Carrejo
Carlos Alberto Del Cueto Carrejo
13,817 Points

I am glad to see that and that you are getting familiar with the syntax, well done.