Page 169 - Ai_V3.0_c11_flipbook
P. 169
You can also use an online Jupyter Notebook through Google Colab (This requires login through your
Gmail account).
Modes in Python
In Python, particularly when using Python IDLE, there are two main modes in which you can work. These modes are
Interactive mode and Script mode.
Interactive Mode
Interactive mode allows you to enter Python commands directly into the command line shell and immediately see the
results. In Interactive mode, we type one command at a time. Interactive mode is useful for quick experimentation,
testing snippets of code, or exploring the behaviour of Python functions and modules. The Interactive mode does not
save the commands entered by the user in the form of a program.
Follow these steps to start Python IDLE and work in Interactive mode:
Step 1: Click on the Start button.
Step 2: Scroll down the list of programs and click on the Python 3.12 folder.
Step 3: Click on the IDLE (Python 3.12 64-bit) app.
The main IDLE window appears. It is a code editor which helps you to write and
execute Python programs in the editor itself.
There are two components of Python IDLE window:
• • • Menu Bar: The Menu Bar of Python IDLE window is similar to the Menu Bar of
other programs. It has various menus such as File, Edit, Shell, Debug, Options, Window and Help.
• • • Prompt: You will see a symbol (>>>) in the window. This is known as the Prompt. The Prompt allows the user to
enter commands directly into Python and get an output instantly by pressing the Enter key.
Menu bar
Prompt
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.
Python Programming 167

