Chapter 3: Running Python

Running Python

face Josiah Wang

There are several ways to use the Python interpreter.

  1. Interactively (useful for quick testing and experiments)
  2. Run the code (useful for larger chunk of codes)
  3. Using an IDE (useful for large projects)

We will discuss these in the next few pages.

Whenever my example says run python, you should replace it with the appropriate python installation for your machine. It could be one of these:

  • python
  • python3
  • python3.12

Whenever I say ‘command line’ or ‘terminal’, use the appropriate application for your operating system.

  • For Windows, this could be PowerShell, Command Prompt or a WSL2 command line terminal.
  • For macOS and Linux/UNIX, this would be ‘Terminal’ or bash.

You likely will need to use command lines a lot for your degree. If you need an introduction to command lines, see this tutorial: Introduction to the command-line interface. MSc AI students will get an introduction to Linux Shell commands during your orientation in your first week.