">>>" sign seen on the Python’s interactive shell is called a prompt. Python’s interactive shell, which appears after firing command “python3” (if we are working on python version 3) on the terminal, has two such prompts.
">>>" - Primary prompt "..." - Secondary prompt
When we fire command ‘python3’ on terminal, >>> sign is immediately seen on screen. This “>>>” sign is nothing but the primary prompt.
Whenever cursor is blinking next to a primary prompt on terminal, it means interpreter will take ‘one and only one’ instruction and execute it immediately if the instruction is found valid
Firstly interpreter will immediately execute
a = 10 while doing so it will create an integer object, store 10 inside that integer object and bind that particular object to a variable called ‘a’
After executing the first instruction, the interpreter moves to the next instruction
b = 20 and immediately executes it, just like it executed
a = 10, and finally prints the output.
However, once we get to see a secondary prompt that is “…”, it means that now we have entered a block, that block can be if block, else block, elif block, while, for or any other block. Once inside a block, ‘…’ signifies, all the instructions of the block, entered in front of “…” will be executed by interpreter together “as a series of instructions”.
Hereafter writing if statement, naturally interpreter enters in if block and starts showing “…”(secondary prompt) to indicate that now the interpreter is ready to take ‘series of instructions’, which will be executed altogether as a group if, ‘if’ statement is found valid.
- Python | Prompt for Password at Runtime and Termination with Error Message
- Python - Read blob object in python using wand library
- MySQL-Connector-Python module in Python
- twitter-text-python (ttp) module - Python
- Python | Merge Python key values to list
- Python | Convert list to Python array
- Python | Index of Non-Zero elements in Python list
- Python | PRAW - Python Reddit API Wrapper
- Reading Python File-Like Objects from C | Python
- Important differences between Python 2.x and Python 3.x with examples
- Python | Sort Python Dictionaries by Key or Value
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Add Logging to Python Libraries
- Python | Add Logging to a Python Script
- Python | Visualizing O(n) using Python
- pow() in Python
- Python if else
- bin() in Python
- Python | a += b is not always a = a + b
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.