• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
16 views

Problem :

Currently I am using the Python 3.3 and I have only entered these 3 below lines:

import sklearn as sk
import numpy as np
import matplotlib.pyplot as plt

But I am facing below error:

“SyntaxError: multiple statements found while compiling a single statement”

What is wrong with my Python code?

by (2.5k points)  

1 Answer

0 votes

Solution :

In the shell script, you can not execute more than the one statement at the same time as shown below:

>>> a = 5
b = 6
“SyntaxError: multiple statements found while compiling a single statement”

 

So you will need to execute them one by one as shown below :

>>> a = 5
>>> b = 6
>>> 

Whenever you see the multiple statements are being declared, that clearly means you're seeing the script, and it will be executed later. But in your interactive interpreter, you can not do more than the one statement at a time.

OR

I had also faced the similar issue in the recent past. I did lot of research on it and found the solution on it. This is the very common problem with the people getting started. If anyone faces the same question then the simple solution which I found was to download the Idlex and use its IDLE version, which allows the multiple lines.

by (33.3k points)  
...