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

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.