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 trialLucas Frischmann
1,397 PointsInvalid Syntax in for loop
Hey team,
Why do I get a syntax error here? If I run it on Jupyter notebook it's printing out fine!
hellos = [
"Hello",
"Tungjatjeta",
"Grüßgott",
"Вiтаю",
"dobrý den",
"hyvää päivää",
"你好",
"早上好"
]
for word in hellos:
print "{} World".format(word)
2 Answers
Nathaniel Bell
6,020 PointsI think you only need to wrap the print with parens and you will be all set!
print("{} World".format(word))
Lucas Frischmann
1,397 PointsThanks Nathaniel for your help. Just copy paste the code again and it works now :( *weird
Nathaniel Bell
6,020 PointsGreat!
Lucas Frischmann
1,397 PointsLucas Frischmann
1,397 PointsThanks, Nathaniel, good point. But still get a syntax error :(
Nathaniel Bell
6,020 PointsNathaniel Bell
6,020 PointsCan you paste your entire code again? I cut and pasted your original, added the parens, and it worked beautifully...