There are two kinds of windows in IDLE.
The ones that say “IDLE Shell” in the title bar are interpreter prompt windows. These will show a banner at the top that looks like:
Python 3.11.2 (main, Apr 5 2023, 03:08:14) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.
automatically when you open them, and give you a >>>
prompt (the word you’re looking for is caret; but that’s still wrong, because it means the ^
symbol) where you can type individual lines of code to run a line at a time.
(For you, the banner looks a bit different, because you have a different version of Python, created using a different compiler, for a different operating system.)
The ones that have a file name (ending in .py
) in the title bar are code editing windows. In these, you type complete Python programs, and save them as Python source code files. Then Python can run the entire program all at once. (This means, for example, that you can call input
and not have to provide the input immediately; you can write the next line of the program directly underneath, and it isn’t used as the input.)
When you type your source code, you should not copy and paste from an interpreter prompt window into the code editing window. That’s because most of what you see in the interpreter prompt window is not actual code, but instead just guideline text to help you understand what’s going on. The >>>
prompts (and ...
continuations) are not part of the Python syntax; they’re just something the interpreter prompt shows you in order to explain that it’s waiting for you to type more code. The message at the top isn’t Python code; it’s just… a message, to tell you what version of Python you’re using and suggest some other special things you can do in the interpreter.
When you type the source code, you need to think and plan out in advance what will happen as the code runs, step by step. You don’t get to see it happening step by step, because the point is to make something that doesn’t have to wait for you to type in the code for the next step.