This course is designed to give delegates the knowledge to develop and maintain Python scripts using the current
version (V3) of Python and comprises sessions dealing with syntax, variables and data types, operators and
expressions, conditions and loops, functions, objects, collections, modules and packages, strings, pattern
matching, exception handling, binary and text files, and databases.
This course aims to provide the delegate with the knowledge to be able to produce Python scripts and applications
that exploit all core elements of the language including variables, expressions, selection and iteration, functions,
objects, collections, strings, modules, pattern matching, exception handling I/O, and classes.
Exercises and examples are used throughout the course to give practical hands-on experience with the techniques
covered
This course is aimed at those who want to improve their Python programming skills, and for developers/engineers
who want to migrate to Python from another language, particularly those with little or no object-oriented knowledge.
For those wishing to learn Python and have no previous knowledge of programming, they should look to attend
our foundation course Introduction to Programming
By actively participating in this course, you will learn about the following:
Writing and testing simple scripts.
Representing data using built-in and custom data types.
Building expressions.
Building conditional and iterative statements.
Declaring and calling functions.
Using objects.
Creating and manipulating collections including lists, tuples, and dictionaries.
Creating and manipulating strings.
Creating modules and packages and using third-party libraries.
Handling exceptions.
Reading from and writing to files and databases.
Coding in an OOP manner.
Delegates attending this course should have some previous programming experience and be able to define
general programming concepts including compilation, execution, variables, arrays, sequence, selection, iteration,
functions, objects, and classes. Moreover, delegates should be able to navigate the filesystem (on the command
line ideally), edit and save text files and browse the web.
This knowledge can be obtained by attendance on the pre-requisite Introduction to Programming course.
Module 1: Course Introduction
Administration and Course Materials
Course Structure and Agenda
Delegate and Trainer Introductions
Module 2: Getting Started
About Python
Python versions
Python documentation
Python runtimes
Installing Python
The REPL shell
Python editors
Module 3: Python Scripts & Syntax
Script naming
Comments
Docstring
Statements
The backslash
Code blocks
The pass keyword
Whitespace
Console IO (to enable the writing of simple programs)
A first Python program
Script execution
Module 4: Variables & Data Types
Literals
Identifiers
Assignment
Numbers (bool, int, float, complex)
Binary, octal, and hexadecimal numbers
Floating point accuracy
Collections (str, list, tuple, set, dict)
None
Implicit and explicit type conversion (casting)
The type and id functions
Module 5: Operators & Expressions
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
Membership Operators
Bitwise Operators
Identity Operators
Module 6: Conditions & Loops
Conditional statements (if, elif, else)
Nested conditional statements
The ternary operator
Iterative statements (while, for, else)
The range function
Iterating over a list
Break
Continue
Nested conditional/iterative statements
Module 7: Functions
Declaration
Invocation
Default values for parameters
Named arguments
args and kwargs
Returning multiple values
None returned
Variable scope
Recursive functions
Module 8: Objects & Classes
Python's data model, dunder-methods and attributes
About objects
Attributes and the dot notation
The dir function
Mutability
Pass by object reference
Introduction to Classes
Class Declaration and Instantiation
Data attributes
Methods
Composition and inheritance
Module 9: Lists
About lists
List syntax including slicing
Getting and setting list elements
Iterating over a list
Checking for the presence of a value
The len function
List methods incl. append, insert, remove, pop, clear, copy, sort and reverse
The del keyword
Appending to and combining lists
List comprehension
Sequence unpacking
Module 10: Tuples
About tuples
Tuple syntax
Iterating over a tuple
Checking for the presence of a value
Appending to and combining tuples
Module 11: Sets
About Sets
Set syntax
Adding and removing set elements
Iterating over a set
Membership Testing
Set methods
Module 12: Dictionaries
About dictionaries
Dictionary syntax
Getting and setting dictionary elements
Iterating over a dictionary (keys, values, and items)
Checking for the presence of a key
Dictionary methods incl. keys, values, items, get, update and clear
The del keyword
Dictionary comprehension
Module 13: Strings
About strings
String syntax including slicing
Escape characters
String literals - single and double quotes, triple quotes
Concatenation
Formatted strings
Other methods e.g. endswith, find, join, lower, replace, split, startswith, strip and upper
Module 14: Modules & Packages
About modules
The dir() and help() functions
Creating and using modules
The __pycache__ and the .pyc files
The module search path
Importing modules
Namespaces
Importing module objects
The import wildcard
Aliases
Executable modules
Reloading a module
About packages
Importing packaged modules
Importing packaged module objects
The Standard Library
The Python Package Index
Installing modules and packages using pip
Module 15: Exception Handling
About exceptions and exception handling
Handling exceptions (try, except, else, finally)
Exception types
The exception object
Raising exceptions
Custom exception types
Built-in exceptions hierarchy
Module 16: Files & the Filesystem
The open function
Methods for reading from a file (readable, read, readline, readlines)
Iterating over a file
Methods for writing to a file (writable, write, writelines)
Introduction to context managers
Text encoding schemes
ASCII and UNICODE (UTF schemes)
UTF-8, binary and hexadecimal representations
The ord() and chr() functions
Binary files, bytes and bytearray
About the pathlib module
Renaming, copying and moving files
Processing all files in a folder
Checking whether a file or folder exists
Creating files and folders
Module 17: Databases
The DB-API
DP-API implementations
Establishing a connection
Creating a cursor
Executing a query
Fetching results
Transactions
Inserting, updating, and deleting records
Module 18: Spreadsheets
Reading from spreadsheets
Creating and editing cells
Cell values, formulae and formatting
Creating and writing spreadsheets
Module 19: Internet
Making requests to web APIs, requesting web pages
Handling responses
Converting to and from JSON
Module 20: Graphics Introduction
Creating, displaying and manipulating images using PIL/Pillow
Simple drawing using Turtle
Graphical user interfaces using Tkinter