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 trialDaniel Carr
551 Pointsi 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
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for hellos
print(hellos) ("world")
2 Answers
behar
10,799 PointsHey 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
1,031 Pointshope below code helps
item_list=[] for items in hellos: item_list.append(items) print(item_list)
behar
10,799 PointsThis code is not a valid solution for this challenge.