COURSE OVERVIEW

 

In this Python training course, students learn to program in Python. The course is aimed at students new to the language who may or may not have experience with other programming languages. This Python course is taught using Python 3; however, differences between Python 2 and Python 3 are noted.

 

 

TARGET AUDIENCE

This course is intended for students who want to learn Python. Some programming experience is helpful but not required.

 

 

Duration

4 days

 

COURSE OBJETIVES

 

  • Understand how Python works and what it’s good for.
  • Understand Python’s place in the world of programming languages.
  • Work with and manipulate strings in Python.
  • Perform math operations with Python.
  • Work with Python sequences: lists, arrays, dictionaries, and sets.
  • Collect user input and output results.
  • Perform flow control processing in Python.
  • Write to and read from files using Python.
  • Write functions in Python.
  • Handle exceptions in Python.
  • Work with dates and times in Python.

 

 

Course Outline

Module 1: Python Basics

Python, which first appeared in 1991, is one of the most popular programming languages in use. Python is a high-level programming language, meaning that it uses a syntax that is relatively human readable, which gets translated by a Python Interpreter into a language your computer can understand. Examples of other popular high-level programming languages are C#, Objective-C, Java, PHP, and JavaScript. Interestingly, all of these other languages, unlike Python, share a C-like syntax. If you use one or more of those languages, you may find Python’s syntax a little strange. But give it a little time. You’ll find it’s quite programmer friendly.

Lessons 1

  • Running Python
  • Hello, World!
  • Literals
  • Python Comments
  • Variables
  • WRiting a Python Module
  • print() Function
  • Collecting User Input
  • Getting Help

Lab 1: Exercises in this Lesson

  • Hello, World
  • Exploring Types
  • A Simple Python Script

 

Module 2: Functions and Modules

This module explains how to work with functions and modules.

Lessons 2

  • Defining Functions
  • Variable Scope
  • Global Variables
  • Function Parameters
  • Returning Values
  • Importing Modules

Lab 2: Exercises in this Lesson

  • A Function with Parameters
    Parameters with Default Values

Module 3: Math

Python includes some built-in math functions and some additional built-in libraries that provide extended math (and related) functionality. In this lesson, we’ll cover the built-in functions and the math and random libraries.

Lessons 3

  • Arithmetic Operators
  • Assignment Operators
  • Built-in Math Functions
  • The math Module
  • The randon Module

Lab 3: Exercises in this Lesson

  • Floor and Modulus
  • How Many Pizzas Do We Need

 

 Module 4: Python Strings

Python includes some built-in math functions and some additional built-in libraries that provide extended math (and related) functionality. In this lesson, we’ll cover the built-in functions and the math and random libraries.

Lessons 4

  • Quotation Marks and Special Characters
  • String Indexing
  • Slicing Strings
  • Concatentaion and Repetition
  • Common String Methods
  • String Formatting
  • Formatted String Literals (f-strings)
  • Built-in String Functions

Lab 4: Exercises in this Lesson

  • Indexing Strings
  • Slicing Strings
  • Repetition
  • Playing with Formatting
  • Getting Acquainted with f-strings
  • Outputting Tab-delimited Text

Module 5: Iterables: Sequences, Dictionaries, and Sets

Iterables are objects that can return their members one at a time. The iterables we will cover in this lesson are lists, tuples, ranges, dictionaries, and sets.

 

Lessons 5

  • Definitions
  • Sequences
  • Unpacking Sequences
  • Dictionaries
  • The len() Function
  • Sets
  • *args and **kwargs

Lab 5: Exercises in this Lesson

  • Remove and Return Random Element
  • Simple Rock, Paper, Scissors Game
  • Slicing Sequences
  • Creating a Dictionary from User Input

Module 6: Flow Control

Generally, a program flows line by line in sequential order. We have seen already that we can change this flow by calling functions. The flow can also be changed using conditional statements and loops.

Lessons 6

  • Conditional Statements
  • Loops in Python
  • break and continue
  • The enumerate() Function
  • Generators
  • List Comprehensions

 

Lab 6: Exercises in this Lesson

  • All True and Any True
  • Word Guessing Game
  • Find the Needle
  • Rolling Dice

Module 7: Virtual Environments

A virtual environment is a container for a Python development platform on your computer. Packages can be installed in the virtual environment that are separate from your standard, or non-virtual environment.

Lessons 7

  • Virtual Environment

Lab 7: Exercises in this Lesson

  • Working with a Virtual Environment

 

Module 8: Regular Expressions

Regular expressions are used to do pattern matching in many programming languages, including, Java, PHP, JavaScript, C, C++, and Perl. We will provide a brief introduction to regular expressions and then we’ll show you how to work with them in Python.

Lessons 8

  • Regular Expression Syntax
  • Python’s Handling of Regular Expressions

 

Module 9: Unicode and Encoding

This module explains how to work with Unicode and encoding.

Lessons 9

  • Bits and Bytes
  • Hexadecimal Numbers
  • Encoding

Lab 9: Exercises in this Lesson

  • Converting Numbers between Number Systems
  • Finding Confusables

 

Module 10: File Processing

Python allows you to access and modify files and directories on the operating system.

Among other things, you can:

  • Open new or existing files and store them in file object variables.
  • Read file contents, all at once or line by line.
  • Append to file contents.
  • Overwrite file contents.
  • List directory contents.
  • Rename files and directories.

Lessons 10

  • Opening Files
  • The os and os.path Modules

 

Lab 10: Exercises in this Lesson

  • Finding Text in a File
  • Writing to Files
  • List Creator

 

Module 11: Exception Handling

This module explains how to handle exceptions in Python.

Lessons 11

  • Wildcard except Clauses
  • Getting Information on Exceptions
  • The else Clause
  • The finally Clause
  • Using Exceptions for Flow Control
  • Raising your Own Exceptions
  • Exception Hierarchy

Lab 11: Excercises in this Lesson

  • Raising Exceptions
  • Running Sum

 

Module 12: Python Dates and Times

This module explains how to work with Python dates and times.

Lessons 12

  • Understanding Time
  • The time Module
  • The datetime Module

Lab 12: Exercises in this Lesson

  • Report on Amtrack Departure Times

 

Module 13: Running Python Scripts from the Command Line

This module explains how to run Python scripts form the command line.

Lessons 13

  • arg
  • path

Lab 13: Exercises in this Lesson

  • Migrating Settings by using Windows Easy Transfer
  • Configuring a Reference Image of Windows 7
  • Configuring a Reference Image