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 trialChristian Vermette
1,025 PointsPlease Help me with for loops
Please help me i need to make each word in hellos print with the word world beside it so the first one should print out like "Hello World" and i need to use a for loop to do it plz help
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for str in hellos:
print(str + 'World')
1 Answer
Jennifer Nordell
Treehouse TeacherYour code is actually just fine. If I copy/paste it and add one single space it passes! The space needs to come before the string 'World'. Otherwise, everything will be squished together. In your code it will print out HelloWorld instead of Hello World. So the challenge fails because of this. See my code for clarification:
for str in hellos:
print(str + ' World') #! note the space before World
Christian Vermette
1,025 PointsChristian Vermette
1,025 Pointsoh i see thanks :P cant believe i forgot a simple space tyvm :D