Python Python Basics (2015) Logic in Python Loop

i tried the .append method and reviewing the video twice but did not see this covered.

i tried the .append method and reviewing the video twice but did not see this covered. Would my code or the .append method both not work? Didn't see this covered in the preceding video

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

2 Answers

Hey Daniel! Couple of things here. One is that your not creating the for loop properly, a for loop should look like this:

for ITEM in VARIABLE: # Here were looping thru a variable, and in each iteration where saving whatever is in that current position to the varibale "ITEM". 
    # Do something

Second is you should try to concatenate whatever the variable "ITEM" currently stores with the string "world". This can be done with the + operator. So your code should look like this:

for i in hellos:
    print(i + " world") # Remember to add a space at the start of the string, since we dont want to display the two words as one

Hope this helps! Note. If you look at the very first thing he explains in the previous video, you will find the solution to this challenge. I recommend rewatching it!

venkat bogadi
venkat bogadi
1,031 Points

hope below code helps

item_list=[] for items in hellos: item_list.append(items) print(item_list)

This code is not a valid solution for this challenge.