IDLE shell vs. code academy

Hello everyone,

I’ve just started studying Python, and I have a question. When I copy a program into the IDLE shell, it gives me an error message (SyntaxError: multiple statements found while compiling a single statement), but if I write it, everything is okay.
However, when I copy it into Codecademy, it doesn’t give any error message. Does IDLE not like copied programs?

If you are referring to the interactive shell,

>>>

it can only take one command at a time, or one function, at a time. Best to open a text editor window for pasting whole blocks of code (File > New File). Once you have it saved, (Run > Run Module) or press F5.

I recommend saving all your Python work in the Scripts folder provided with your installation. You can create folders inside that one to better organize your projects.

Also note, the interactive shell itself can be Saved As so you can keep all your shell activity logged. What I’ve done for years is create a Shells folder in the Scripts folder, and Save As by the date,

20240303.py

You can keep using the shell, but occasionally you will want to Save, as you go. How often you close the shell will be up to you. We cannot run code in the saved files, but we can always go back into the files and copy our code to an open and active shell.

1 Like

ok noted, thanks a lot

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.