How to run Python commands?

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:

  1. Open your terminal.
  2. Type python or python3 and press Enter. This will start the Python interpreter.
  3. 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.

0 Comments

no data
Be the first to share your comment!