Python Course Outline

Python/Django Course

Python contents

Introduction and Motivation to Python

Setting Up Your Programming
Python 2 and Python 3
Running Snippets of Python Hello World
Python on Different Operating Systems
Installation Python and PyCharm tool
Python on Linux
Python on Windows

Variables and Simple Data Types

Naming and Using Variables
Avoiding Name Errors When Using Variables Simple Messages
Changing Case in a String with Methods Combining or Concatenating Strings
Adding Whitespace to Strings with Tabs or Newlines
Stripping Whitespace
Avoiding Syntax Errors with Strings
Numbers, Integers, Floats
Integers in Python 3

Introducing and working with Lists

What Is a List
Accessing Elements in a List
Index Positions Start at 0, Not 1
Using Individual Values from a List
Changing, Adding, and Removing Elements
Modifying Elements in a List
Adding Elements to a List
Removing Elements from a List
More Guests
Shrinking Guest List
Organizing a List
Sorting a List Permanently with the sort()Method Sorting a List Temporarily with the sorted() Function
Printing a List in Reverse Order
Finding the Length of a List
Dinner Guests
Every Function
Avoiding Index Errors When Working with Lists Intentional Error

Working with List

Looping Through an Entire List
A Closer Look at Looping
Doing More Work Within a for Loop
Doing Something After a for Loop
Avoiding Indentation Errors
Forgetting to Indent
Forgetting to Indent Additional Lines
Indenting Unnecessarily
Indenting Unnecessarily After the Loop
Forgetting the Colon
Using the range() Function
Using range() to Make a List of Numbers
Simple Statistics with a List of Numbers
List Comprehensions
Hands On Exercise

If statements

A Simple Example
Conditional Tests Checking for Equality
Ignoring Case When Checking for Equality
Checking for Inequality
Numerical Comparisons
Checking Multiple Conditions
Checking Whether a Value Is in a List
Checking Whether a Value Is Not in a List
Boolean Expressions
Conditional Tests
If, if-else, chain, if-elif-else
Nested If statement

Dictionaries in Python

Working with Dictionaries
Accessing Values in a Dictionary
Adding New Key-Value Pairs
Modifying Values in a Dictionary
Removing Key-Value Pairs
A Dictionary of Similar Objects
Looping Through a Dictionary, Key-Value Pairs
Looping Through All the Keys in a Dictionary
Looping Through a Dictionary’s Keys in Order

User Input and while loops

How the input() Function Works
Writing Clear Prompts
Using int() to Accept Numerical Input
The Modulo Operator
Accepting Input in Python 2

Functions in Python

Defining a Function
Passing Information to a Function
Arguments and Parameters
Avoiding Argument Errors
Return Values
Returning a Simple Value
Making an Argument Optional
Returning a Dictionary
Using a Function with a while Loop
Passing a List
Modifying a List in a Function
Preventing a Function from Modifying a List


Files and Exceptions

Reading from a File
Reading an Entire File
File Paths
Reading Line by Line
Making a List of Lines from a
Working with a File’s Contents
Large Files: One Million
Working with Multiple Files
Failing Silently
Deciding Which Errors to Report
Using json .dump() and json .load()
Saving and Reading User-Generated Data

Python Programming: Language & Syntax

Data types and dynamic typing
Functions and lambdas
Statements and expressions
Lists, tuples and dictionaries
Easy I/O

Object-Oriented Programming with Python

Overview of Object-oriented (OO) programming
Objects and classes
Exception handling
Inheritance and the object hierarchy

Polymorphism and advanced OO in Python

Duck typing and multiple inheritance
Understanding init and new
Static methods and class methods

Django Web App Development

Introduction to Django

What is Django?
Django and Python
Django’s take on MVC: Model, View and Template
How to get and install Django

Getting started with Django

About the 3 Core Files:
Setting up database connections
Managing Users & the Django admin tool
Installing and using ‘out of the box’ Django features

Django URL Patterns and Views

Designing a good URL scheme
Generic Views

Django Forms

Form classes
Advanced Forms processing techniques