![if !IE]> <![endif]>
MODES OF PYTHON INTERPRETER:
Python Interpreter is a program that reads and executes Python code. It uses 2 modes of Execution.
1. Interactive mode
2. Script mode
v Interactive Mode, as the name suggests, allows us to interact with OS.
v When we type Python statement, interpreter displays the result(s) immediately.
v Python, in interactive mode, is good enough to learn, experiment or explore.
v Working in interactive mode is convenient for beginners and for testing small pieces of code.
v We cannot save the statements and have to retype all the statements once again to re-run them.
In interactive mode, you type Python programs and the interpreter displays the result:
>>> 1 + 1
The chevron, >>>, is the prompt the interpreter uses to indicate that it is ready for you to enter code. If you type 1 + 1, the interpreter replies 2.
>>> print ('Hello, World!')
This is an example of a print statement. It displays a result on the screen. In this case, the result is the words.
v In script mode, we type python program in a file and then use interpreter to execute the content of the file.
v Scripts can be saved to disk for future use. Python scripts have the extension .py, meaning that the filename ends with .py
v Save the code with filename.py and run the interpreter in script mode to execute the script.
v Is a graphical user interface which is completely written in Python.
v It is bundled with the default implementation of the python language and also comes with optional part of the Python packaging.
Multi-window text editor with syntax highlighting.
v Auto completion with smart indentation.
Python shell to display output with syntax highlighting.
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.