The Python Interactive Shell, also known as REPL (Read-Eval-Print Loop), is an interactive command-line environment where you can write and execute Python code line by line. It allows you to test out code snippets quickly, making it a useful tool for learning, debugging, and experimenting with Python code.
what each part of REPL means:
1. Read: The shell reads the user’s input (a Python statement or expression).
2. Eval: It evaluates the input, executing the Python code.
3. Print: It prints the result of the expression or statement to the console.
4. Loop: It then loops back to prompt the user for more input.
You can start the Python interactive shell by simply typing python
(or python3
depending on your setup) in your terminal or command prompt.
Example: print Hello, Friends!
>>> print("Hello, Friends!")
Hello, World!
Example2: Add two numbers
>>> 5 + 7
12