LambdaLabTM
Computer Science · Class 11 · Displaying Output
OutputSetup⏱️ 8 min read

Revisiting Script Mode

You have met script mode already, and you now know enough print() to write something worth saving. So let us do the whole thing properly, start to finish: open a file, write a few lines, save it with the right name, and run it — this time in IDLE, the program that came free with Python.

1First: IDLE is an IDE

When you installed Python, you also got a program called IDLE. Search for it in your Start menu and it opens. It is not just a place to type code — it is an IDE.

Key Takeaway
IDE stands for Integrated Development Environment. It is a special kind of software for writing code. It puts everything you need in one place: somewhere to type your program, a button to run it, colours that make the code easier to read, and help finding your mistakes (called debugging). You could write code in Notepad — but you would be doing all of that by hand.

IDLE is the simplest one, which is exactly why we start there. There are many others, and you will hear these names:

IDLE

Comes free with Python. Small, plain, and enough for everything in this course. This is the one your school will use.

VS Code

Free, and what a great many working programmers use every day. More powerful, and more to learn.

PyCharm

Built for large Python projects. It has a tool for everything, which makes it powerful — and a lot to take in at the start.

Thonny

Made for beginners, and friendlier than IDLE. It can show you your program running one step at a time.

Jupyter Notebook

Runs code in small blocks with the results underneath each one. You will meet it if you go on to data science.

Note
They all run the same Python. An IDE does not change the language — print('Hi') behaves identically in all of them. It only changes how comfortable you are while writing it. Learn Python, not the IDE.

2Writing and running a script in IDLE

Four steps, and that is the whole job. Click through them and watch what changes each time.

IDLE Shell 3.13.1
FileEditShellDebugOptionsWindowHelp
New File
Open...
Save
Save As...
Exit
Python 3.13.1 (main, Dec 3 2024, 17:59:52)
Type "help", "copyright", "credits" or "license()" for more information.
>>>
# this is interactive mode. Your program does not go here.

Step 1. IDLE opens in interactive mode — the window with the >>> prompt. You do not type your program here. Go to File → New File. An empty editor window opens.

Tip
The pictures above are drawings of IDLE, not photos — IDLE looks slightly different on Windows, on a Mac and on Linux. The words you need are the same everywhere: File → New File, then File → Save, then Run → Run Module (or just press F5).
Note
One label to expect: the title bar of the >>> window says IDLE Shell. Shell is simply the name IDLE gives to interactive mode. Same window, same >>>, same thing you already know — do not let the extra word worry you.

3The file you just wrote

Here is the whole file on its own, away from the IDLE window. This is all a Python program really is — plain lines in a saved file, run from top to bottom.

📄 marks.py
print('Ramesh Kumar')
print('Class:', 11)
print('Marks:', 87 + 8)
Output
Ramesh Kumar
Class: 11
Marks: 95

Three print() calls, so three lines of output. The last one does the sum first and prints only the answer — exactly as it did at the prompt. Nothing about print() changed. Only where you typed it changed.

4Three slips that catch everyone

1. Typing >>> into the file

The >>> is Python's prompt in interactive mode. It is not part of the code. Put it in a file and you get a SyntaxError.

2. Forgetting the .py

Save it as marks and it is a plain text file. Save it as marks.py and it is a Python program. The extension is how the computer knows.

3. Running before saving

IDLE runs the saved file, not what is on your screen. Edit a line, press F5 without saving, and IDLE will stop and ask you to save first. Say yes.

5Which mode, from here on

You now know print() and you know how to write and run a file. That is enough to write real programs, so from the next topic onwards we will mostly work in script mode. Real code gets long, needs editing, and has to survive being closed — and only a file does all three.

Interactive mode does not go away, though. It stays the fastest way to check one small thing: what does this sum come to, does this line do what I think it does. You will see it used again and again for exactly that, all through the course.

Key Takeaway
Script mode for anything you want to keep, and for anything longer than a line or two — which, from now on, is most things. Interactive mode for a quick test.

6Recap

Key Takeaway
IDLE is an IDE — software that gives you one place to write code, run it and fix it. In IDLE: File → New File, type your lines with no >>>, File → Save with a name ending in .py, then Run → Run Module or F5. The output appears back in the interactive mode window, all at once.
Quick Check

What does IDE stand for?

Quick Check

You save your file as 'marks' instead of 'marks.py'. What happens?

Quick Check

Which key runs the file you are editing in IDLE?