Getting Started with Python on Ubuntu - Writing Your First Program

Overview

The Python Security Lab Series examines programming with Python in the Ubuntu environment using a CLI (Command Line Interface). Python is a powerful scripting tool that can be very useful for a cyber security professional. While a Graphical User Interface provides easy point and click operation for the user, its functionality is limited to manual interaction with the user. The CLI is preferred by “power users” for many applications and lends itself very well to automated tasks.

This lab provides step-by-step instructions on how to setup a software development environment in Ubuntu and to write and test a basic Python script.

Programs typically have bugs in them when they are first written. Recognizing the causes makes fixing the bugs easy. These labs purposely introduce the most common bugs and highlight the causes to help reduce the learning curve and make programming more enjoyable.

outcomes

In this lab, you will learn to:

  • Set up a simple scripting environment to help organize the student’s work.
  • Configure Geany, a simple IDE (Integrated Development Environment).
  • Introduce the student to debugging.
  • Create a first program that does basic input and output via a CLI.
  • Introduce the student to variables.

Key terms and descriptions

Geany
A programmer's text editor.
variable
A variable is a location that stores numbers and strings.
raw_input
A python function to accept input from the user.