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 trialJoshua Hoy
533 PointsCan't find all Hello's?
I thought it would be as simple the code I wrote, seems to not pick up all Hello's
I also deleted certain parts of the code as i thought my browser/computer doesn't support or know what mandarin or cantonese were (Sorry if those weren't the languages!)
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää"
]
for hellos in [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää"
]:
print (hellos + "World")
Noah Fields
13,985 PointsThe problem here seems to be that you are writing the list twice. Instead of beginning with hellos, and then writing it again for your loop, try this:
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää"
]
for x in hellos:
print (x + "World")
Nick Lenzi
7,979 PointsNick Lenzi
7,979 PointsYou're actually really close. when you are using a for loop to iterate through a list whatever follows for is a temporary variable
So any variable can be used as long as it isn't a preset variable already defined.
for (temp variable) in (list to be iterated from):
Hope that helps :)