Page 421 - ComputerScience_Class_11
P. 421
# Quantities stored in memory are not displayed by default.
>>> x
# If a quantity is stored in memory, typing its name will display it.
[0, 1, 2]
# Calculations can be performed directly.
>>> 2+3
5
The above executed statements will look like as follows when executed in interactive mode:
12.6.2 Running Python in script mode
Script Mode in Python IDLE is used to write, save and run complete Python programs. In script mode, the program is
written in an editor window, saved with a .py extension and then executed all at once.
Steps to run a program in script mode:
Step 1: Open Python IDLE.
Step 2: Click on the File → New File.
A new editor window will open.
Step 3: Type your Python program in the editor window.
Step 4: Save the file using File → Save (or press Ctrl + S).
Use the .py extension (example: test.py).
Step 5: Run the program by clicking Run → Run Module
or press F5.
Step 6: The output will be displayed in the Python Shell.
For example, To display a message, use the print() function.
Program.py
File Edit Format Run Options Window Help
print("Python is easy to learn")
print("This program runs in script mode")
Installation & IDE and Fundamentals of Python Programming 419

