Page 52 - Touhpad Ai
P. 52
Type the commands at the prompt and you will immediately get the results. Simply, type 3 + 3 and press the Enter key.
The result 6 appears on the screen. Try more values with different operations and see result.
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.
50 Touchpad Artificial Intelligence - XI

