Skip to content

Use

  • Write code in an interactive session from a terminal.
  • Write a Python module (py-file). And run it with:
  • Run

Interactive Session

  • In a terminal, type python or python3, depending on the settings on your computer. And start coding.
  • Type exit() to exit the interactive session.

Code Python in an interactive session.
Figure 1: Code Python in an interactive session.


Write Python Module

In Terminal

Text editor in terminal, like vim.

Code Python with Vim from a terminal.
Figure 2: Code Python with Vim from a terminal.

Plain Text Editor

Plain text editor, like Windows Notepad.

Code Python with Notepad.
Figure 3: Code Python with Notepad.

IDE

IDE: Integrated Development Environment

  • Syntax high-lighting
  • Code formatting and analysis
  • Run and debug

Run

Command Line

  1. Write the hello-world file and use the file name hello_world.py.
  2. In a terminal, navigate to the directory where this file is stored, type the command

    python <filename.py>
    

    Note

    <...> is a placeholder.

Run with command line
Figure 4: Run with command line

IDE

Click the Run button on an IDE.

Run with IDE
Figure 5: Run with IDE