To run Python commands, you can use the interactive mode, also known as the REPL (Read-Eval-Print Loop). Here’s how to do it:
- Open your terminal.
- Type
pythonorpython3and press Enter. This will start the Python interpreter. - You will see a prompt (
>>>) where you can start typing your Python commands.
For example:
>>> print('hello world')
hello world
>>> 37 * 42
1554
To continue a statement, you can use the ... prompt. Enter a blank line to finish typing and run what you've entered.
If you want to exit the interactive mode, you can type exit() or press Ctrl + D.
