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 trial

Python Python Basics (2015) Logic in Python Loop

Mark Kohner
Mark Kohner
1,121 Points

python logic in python loop , stuck on error

hellos = [ "Hello", "Tungjatjeta", "Grüßgott", "Вiтаю", "dobrý den", "hyvää päivää", "你好", "早上好" ]

for lan in hellos: print(lan)

SyntaxError: multiple statements found while compiling a single statement

when I try to run this in python I get this error, when I run this or for lan in hellos: print(lan + 'World')

I get 'Bummer! Didn't find all the "Hello's" as an error message. I have watched the video twice but do not see why this is causing an error.

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


for lan in hellos:
  print(lan + 'World')

1 Answer

Jhonatan Laguna
Jhonatan Laguna
7,983 Points
for lan in hellos:
  print(lan + ' World')

Just add a space before World