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

can someone explain...

i need an explination.... cannot find all the hellos. and world is not defined.....

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

3 Answers

Hi Justin

The task is asking you to loop through the list hellos and print out each word followed by the word "World". So for the first item in the list it should print out "Hello World". You dont need to check if greetings is equal to hello but concatinate greetings and the word "World".

see below

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

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

which is very confusing because the in video, aside from the example powerpoint in the introduction that briefly gives examples of the for loops and while loops which shows " print(greetings+" World") " it is not demonstrated anywhere else in the lesson therefore how are we able to apply what hasnnt been directly pointed out?

but thank you. many issues i am running into isnt because i cannot figure it out, it is either because the instructions are unclear or the information has been presented cryptically

Hi Justin

Sorry your running into so many issues. When ever i don't understand something i will go back and watch the video again or try and replicate whats being taught into my own way. If i encounter errors i try to fix it which helps me understand whats going on. In terms of the challenges, well whats asked of you sometimes is not in the video's and the reason for that is to challenge your understanding of the topic and in most cases that helps a lot ( Well it did for me anyway) . Hope that answers your question.

Please select best answer for this question so others in the forum know it has been answered.