Page 226 - Ai_V1.0_Class9
P. 226
Brainy Fact
Many big companies, like Facebook, Google, NASA, MIT, Nokia, IBM, and many more, use Python
for their products and services.
Working in Python
IDLE is the standard, most popular Python development environment. It allows you to write, edit, run, browse
and debug the Python programs from a single interface.
We can interact with Python IDLE in two different modes:
• Interactive Mode (Python IDLE-Shell Mode): In this mode, you type one command at a time in front of the
Python command prompt (>>>) and Python gives you the result based on the command given. It means you
run code directly on shell mode accessed through the terminal of an operating system. This mode will not save
your commands and outputs and should be used only when you want to play with small one-line instructions.
You can also use the print( ) function to print the messages on the Shell window.
Interactive mode
• Script Mode (Editor): In this mode, you save all your commands together in any text editor with the extension
.py. When we run this text file .py then the output of the commands will be
displayed in Shell mode.
The steps to write and save a program are as follows:
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.
Step 4 Type the program code in Python window.
The New File Option
Write Code
224 Artificial Intelligence Play (Ver 1.0)-IX

