Python Forum
SyntaxError: multiple statements found while compiling a single statement - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: SyntaxError: multiple statements found while compiling a single statement (/thread-14352.html)



SyntaxError: multiple statements found while compiling a single statement - DragonG - Nov-26-2018

This code works on Codecademy, but when I use it in Python I get an error message:
SyntaxError: multiple statements found while compiling a single statement
Why doesn't this code work in Python? Here is the code.
mylist = [2, 3, 4]
result = []
for number in mylist:
  result.append(number*2)
print result 



RE: SyntaxError: multiple statements found while compiling a single statement - Larz60+ - Nov-26-2018

Always post the error traceback in it's entirity and unmodified.
This code should run fine in python 2.7
in python 3, you have to modify the print statement to:
print(result)
.

FIY: indentation should be 4 spaces, as per PEP8.