• Decrease font size
  • Default font           size
  • Increase font size

Python Part 1

Print E-mail

Course Description

This course introduces the student to the basics of writing and running Python scripts, such as variables, file operations, and flow control. Emphasis is placed on features unique to Python, such as tuples, array slices, and output formatting.

This is a hands-on programming class. All concepts are reinforced by informal practice during the lecture followed by graduated lab exercises.

Python Intro is a practical introduction to a working programming language, not an academic overview of syntax and grammar. After competing Part 2, students will immediately be able to use Python to complete tasks in the real world.

Who Should Attend?

This course is appropriate for advanced users, system administrators and anyone else who wants to automate or simplify common tasks with Python scripts. It is also a good foundation for web site administrators who want to use a Python-based framework such as Zope or Django to support their server installations.

Course Prerequisites

Students should be comfortable working at an operating system prompt, and using an editor.

Workshop exercises

Students will write numerous Python scripts to reinforce the major concepts covered in this course. The labs will increase in complexity as more sophisticated techniques are introduced.

Exercises will include all important topics covered in the lecture portion of the class. There are short "try-me" labs during the lecture, and then a longer lab at the end of each chapter.

 Public Course Information and Registration Page

Course Outline:

An overview of Python

  • What is Python?
  • Interpreted languages
  • Advantages and disadvantages
  • Downloading and installing
  • Which version of Python
  • Where to find documentation

The Python Environment

  • Structure of a Python program
  • Using the interpreter interactively
  • Running standalone scripts under Unix and Windows

Getting Started

  • Using variables
  • String types: normal, raw, and Unicode
  • String operators and expressions
  • Numeric literals
  • Math operators and expressions
  • Writing to the screen
  • Command line parameters
  • Reading from the keyboard

Flow Control

  • About flow control
  • Indenting is significant
  • The if and elif
  • while loops
  • Using lists
  • Using the for statement
  • The range() function

Lists and Other Sequences

  • list operations
  • list methods
  • Strings are special kinds of lists
  • tuples
  • sets
  • dictionaries

Defining functions

  • Syntax of function definition
  • Formal parameters
  • Global versus local variables
  • Passing parameters and returning values

Working with files

  • Text file I/O overview
  • Opening a text file
  • Reading text files
  • Raw (binary) data
  • Using the pickle module
  • Writing to a text file

Dictionaries and Sets

  • Dictionary overview
  • Creating dictionaries
  • Dictionary functions
  • Fetching keys or values
  • Testing for existence of elements
  • Deleting elements