Page 170 - AI_Ver_3.0_class_11
P. 170
Script Mode
Script mode refers to writing and running Python programs as standalone scripts, rather than executing code interactively.
Script mode involves writing Python code in a text file with a .py extension and then executing that file using the Python
interpreter. You create Python scripts using a text editor or an Integrated Development Environment (IDE) and then run
them from the command line or terminal. Script mode is suitable for developing larger programs, modules, or scripts
that perform specific tasks or functions.
Create a New File
Follow these steps to create a new file:
Step 1: Open the Python IDLE window.
Step 2: Click on the File menu. A drop-down menu appears.
Step 3: Click on the New File option.
A new editor window with a blank file will appear on the screen.
Create and Save a Program
The steps to write and save a program are as follows:
Step 1: Type the program code in Python window.
Step 2: Click on the File menu.
Step 3: Click on the Save option. The Save As dialog box appears.
Step 4: Navigate the location where you want to save the file.
Step 5: Enter the name of the file in the File name text box.
Step 6: Click on the Save button.
The file will be saved by the given name at the specified location.
168 Touchpad Artificial Intelligence (Ver. 3.0)-XI

