Source Code Section
Last updated: 09/06/2021
Below are links to all the source code in this course. You can download project source code for each lecture in the course individually.
3. Stepping Into the World of Python
Source code - Stepping Into the World of Python - Our First Python Program
Source code - Stepping Into the World of Python - Printing in Python
Source code - Stepping Into the World of Python - Strings in Python
Source code - Stepping Into the World of Python - The Escape Character
Source code - Stepping Into the World of Python - More on Escape Characters in Strings
Source code - Stepping Into the World of Python - Variables and Types
Source code - Stepping Into the World of Python - Is Python a Strongly Typed Language?
Source code - Stepping Into the World of Python - Numeric Operators
Source code - Stepping Into the World of Python - Expressions
Source code - Stepping Into the World of Python - Operator Precedence
Source code - Stepping Into the World of Python - The str String Data Type
Source code - Stepping Into the World of Python - Negative Indexing in Strings
Source code - Stepping Into the World of Python - Slicing
Source code - Stepping Into the World of Python - Slicing with Negative Numbers
Source code - Stepping Into the World of Python - Using a Step in a Slice
Source code - Stepping Into the World of Python - Slicing Backwards
Source code - Stepping Into the World of Python - Challenge Solution and Slicing Idioms
Source code - Stepping Into the World of Python - String Operators
Source code - Stepping Into the World of Python - String Replacement Fields
Source code - Stepping Into the World of Python - String Formatting
Source code - Stepping Into the World of Python - f-strings
Source code - Stepping Into the World of Python - Python 2 String Interpolation
4. Program flow control in Python
Source code - Program flow control in Python - Introduction to Blocks and Statements
Source code - Program flow control in Python - if Statements
Source code - Program flow control in Python - elif
Source code - Program flow control in Python - Using a Debugger in IntelliJ or Pycharm
Source code - Program flow control in Python - More on if, else and else
Source code - Program flow control in Python - if, elif, and else in the Debugger
Source code - Program flow control in Python - Adding a Second Guess
Source code - Program flow control in Python - Conditional Operators
Source code - Program flow control in Python - Challenge Solution
Source code - Program flow control in Python - Using and, or, in Conditions
Source code - Program flow control in Python - Simplify Chained Comparison
Source code - Program flow control in Python - Boolean Expression True and False
Source code - Program flow control in Python - Truthy Values
Source code - Program flow control in Python - in and not in
Source code - Program flow control in Python - Solution to if Challenge
Source code - Program flow control in Python - for loops
Source code - Program flow control in Python - Stepping through a for loop
Source code - Program flow control in Python - for loops Extracting Values from User Input
Source code - Program flow control in Python - Iterating Over a Range
Source code - Program flow control in Python - More About Ranges
Source code - Program flow control in Python - Nested for loops
Source code - Program flow control in Python - continue
Source code - Program flow control in Python - break
Source code - Program flow control in Python - Initialising Variables and None
Source code - Program flow control in Python - while loops
Source code - Program flow control in Python - More on while loops
Source code - Program flow control in Python - Break in a while loop
Source code - Program flow control in Python - The Random Module and Import
Source code - Program flow control in Python - Challenge Solution
Source code - Program flow control in Python - Hi Lo Game
Source code - Program flow control in Python - Pass Statement and Complete the Hi Lo Game
Source code - Program flow control in Python - Testing the Hi Lo Game
Source code - Program flow control in Python - Augmented Assignment
Source code - Program flow control in Python - PEP8: The Python Style Guide
Source code - Program flow control in Python - Refactoring Code
Source code - Program flow control in Python - else in a loop
Source code - Program flow control in Python - else in the Hi Lo Game
Source code - Program flow control in Python - Conditional Debugging
Source code - Program flow control in Python - Another else Example
Source code - Program flow control in Python - Section Challenge Solution
Source code - Program flow control in Python - Optional Extra Challenge Solution
Source code - Program flow control in Python - Changing the Condition
5. Lists, Tuples and Ranges
Source code - Lists, Tuples and Ranges - Lists
Source code - Lists, Tuples and Ranges - Immutable Objects
Source code - Lists, Tuples and Ranges - Mutable Objects
Source code - Lists, Tuples and Ranges - Binding Multiple Names to a List
Source code - Lists, Tuples and Ranges - Common Sequence Operations
Source code - Lists, Tuples and Ranges - Operations on Mutable Sequences
Source code - Lists, Tuples and Ranges - Appending to a List
Source code - Lists, Tuples and Ranges - Mini Challenge Solution
Source code - Lists, Tuples and Ranges - Iterating Over a List
Source code - Lists, Tuples and Ranges - Enumerate Function
Source code - Lists, Tuples and Ranges - Improving our Code
Source code - Lists, Tuples and Ranges - Removing Items from a List
Source code - Lists, Tuples and Ranges - Sorting Lists
Source code - Lists, Tuples and Ranges - Sorting Things
Source code - Lists, Tuples and Ranges - Case-Insensitive Sorting
Source code - Lists, Tuples and Ranges - Creating Lists
Source code - Lists, Tuples and Ranges - The Documentation
Source code - Lists, Tuples and Ranges - Deleting Items from a List
Source code - Lists, Tuples and Ranges - Removing items from a list
Source code - Lists, Tuples and Ranges - Removing the High Values
Source code - Lists, Tuples and Ranges - Testing the Program
Source code - Lists, Tuples and Ranges - Removing Items from a List Backwards
Source code - Lists, Tuples and Ranges - The Reversed Function
Source code - Lists, Tuples and Ranges - Algorithms Performance
Source code - Lists, Tuples and Ranges - Nested Lists & Code Style
Source code - Lists, Tuples and Ranges - Processing Nested Lists
Source code - Lists, Tuples and Ranges - Solution to nospam Challenge
Source code - Lists, Tuples and Ranges - print Revisited
Source code - Lists, Tuples and Ranges - The join Method
Source code - Lists, Tuples and Ranges - The split Method
Source code - Lists, Tuples and Ranges - Solution to Mini Challenge
Source code - Lists, Tuples and Ranges - Tuples
Source code - Lists, Tuples and Ranges - Tuples are Immutable
Source code - Lists, Tuples and Ranges - Unpacking a Tuple
Source code - Lists, Tuples and Ranges - Practical uses for Unpacking Tuples
Source code - Lists, Tuples and Ranges - More Unpacking
Source code - Lists, Tuples and Ranges - Nested Tuples and Lists
Source code - Lists, Tuples and Ranges - Solution to Unpacking Challenge
Source code - Lists, Tuples and Ranges - Nested Data Structures
Source code - Lists, Tuples and Ranges - Nested Indexing
Source code - Lists, Tuples and Ranges - Simple Jukebox - Importing Data
Source code - Lists, Tuples and Ranges - Simple Jukebox - The Code
Source code - Lists, Tuples and Ranges - Constants in Python
Source code - Lists, Tuples and Ranges - Finishing the Code
Source code - Lists, Tuples and Ranges - Challenge Solution
6. Functions - An Introduction
Source Code - Functions - An Introduction - Defining a Function
Source Code - Functions - An Introduction - Program Flow when Calling a Function
Source Code - Functions - An Introduction - Parameters and Arguments
Source Code - Functions - An Introduction - Debugging with Parameters
Source Code - Functions - An Introduction - Palindromes
Source Code - Functions - An Introduction - Palindromes Challenge Solution
Source Code - Functions - An Introduction - Sentence Challenge Solution
Source Code - Functions - An Introduction - Functions Calling Functions
Source Code - Functions - An Introduction - Returning Values
Source Code - Functions - An Introduction - get_integer Challenge Solution
Source Code - Functions - An Introduction - Returning None
Source Code - Functions - An Introduction - Functions that Perform Actions
Source Code - Functions - An Introduction - Handling Invalid Arguments
Source Code - Functions - An Introduction - Width Challenge Solution
Source Code - Functions - An Introduction - Default Parameter Values
Source Code - Functions - An Introduction - Keyword Arguments
Source Code - Functions - An Introduction - Docstrings
Source Code - Functions - An Introduction - Write a Docstring
Source Code - Functions - An Introduction - How Professional is that!
Source Code - Functions - An Introduction - Writing a Fibonacci Function
Source Code - Functions - An Introduction - Function Annotations and Type Hints
Source Code - Functions - An Introduction - Function Annotations with Default Values
Source Code - Functions - An Introduction - Printing in Colour
Source Code - Functions - An Introduction - Colorama Module and Virtual Environments
Source Code - Functions - An Introduction - A Function to Test our HiLo Game
Source Code - Functions - An Introduction - Counting Correct Guesses
Source Code - Functions - An Introduction - Playing Fizz Buzz
Source Code - Functions - An Introduction - Playing Fizz Buzz Solution
Source Code - Functions - An Introduction - *args
Source Code - Functions - An Introduction - colour_print with Multiple Arguments
Source Code - Functions - An Introduction - Defining Different Parameter Types
7. Dictionaries and Sets
Source code - Dictionaries and Sets - What is a dictionary?
Source code - Dictionaries and Sets - Iterating over a dictionary
Source code - Dictionaries and Sets - Adding items to a dictionary
Source code - Dictionaries and Sets - Changing values in a dictionary
Source code - Dictionaries and Sets - Removing items from a dictionary
Source code - Dictionaries and Sets - Using `in` with a dictionary
Source code - Dictionaries and Sets - Dictionary menu challenge solution
Source code - Dictionaries and Sets - Adding items to a dictionary
Source code - Dictionaries and Sets - Smart fridge
Source code - Dictionaries and Sets - What's for tea?
Source code - Dictionaries and Sets - Using several dictionaries together
Source code - Dictionaries and Sets - Checking the pantry
Source code - Dictionaries and Sets - Checking quantities - choosing a data structure
Source code - Dictionaries and Sets - Checking quantities - the code
Source code - Dictionaries and Sets - Solution: Create a shopping list challenge
Source code - Dictionaries and Sets - Wrong decisions don't have to be fatal
Source code - Dictionaries and Sets - The setdefault method
Source code - Dictionaries and Sets - The remaining `dict` methods
Source code - Dictionaries and Sets - The dict `update` method
Source code - Dictionaries and Sets - The dict `values` method
Source code - Dictionaries and Sets - References to mutable objects
Source code - Dictionaries and Sets - Shallow copy
Source code - Dictionaries and Sets - Deep copy
Source code - Dictionaries and Sets - Simple deep copy solution
Source code - Dictionaries and Sets - A really bad hashing function
Source code - Dictionaries and Sets - Hash tables
Source code - Dictionaries and Sets - Completing our simple dictionary implementation
Source code - Dictionaries and Sets - hashlib, the secure hash module
Source code - Dictionaries and Sets - Python sets
Source code - Dictionaries and Sets - Implications of sets being unordered
Source code - Dictionaries and Sets - set membership
Source code - Dictionaries and Sets - Adding items to a set
Source code - Dictionaries and Sets - Using a set to remove duplicate values
Source code - Dictionaries and Sets - Deleting items from a set
Source code - Dictionaries and Sets - The `discard` method
Source code - Dictionaries and Sets - The `remove` method
Source code - Dictionaries and Sets - The `pop` method
Source code - Dictionaries and Sets - set union
Source code - Dictionaries and Sets - Set union in practice
Source code - Dictionaries and Sets - Union update
Source code - Dictionaries and Sets - Advantage of the set operation methods over the operators
Source code - Dictionaries and Sets - Set intersection
Source code - Dictionaries and Sets - Set intersection in practice
Source code - Dictionaries and Sets - Set difference
Source code - Dictionaries and Sets - Set difference in practice
Source code - Dictionaries and Sets - Set symmetric difference
Source code - Dictionaries and Sets - subsets and supersets in Python
Source code - Dictionaries and Sets - Practical application of subsets and supersets
8. Input and Output
Source Code - Input and Output (I/O) in Python - Reading and writing text files
Source Code - Input and Output (I/O) in Python - Writing Text Files
Source Code - Input and Output (I/O) in Python - Appending to Files and Challenge
Source Code - Input and Output (I/O) in Python - Writing Binary Files Manually
Source Code - Input and Output (I/O) in Python - Using Pickle To Write Binary Files
Source Code - Input and Output (I/O) in Python - Shelve
Source Code - Input and Output (I/O) in Python - Manipulating Data With Shelve
Source Code - Input and Output (I/O) in Python - Updating With Shelve
Source Code - Input and Output (I/O) in Python - Shelve Challenge
Source Code - Input and Output (I/O) in Python - Challenge Continued
9. Modules and Functions
Source Code - Modules and Functions in Python - Modules and import
Source Code - Modules and Functions in Python - The standard Python library
Source Code - Modules and Functions in Python - WebBrowser Module
Source Code - Modules and Functions in Python - Time and DateTime in Python
Source Code - Modules and Functions in Python - Time (Continued) and Challenge.
Source Code - Modules and Functions in Python - Timezones
Source Code - Modules and Functions in Python - Using Timezones
Source Code - Modules and Functions in Python - More on Timezones
Source Code - Modules and Functions in Python - Timezone Challenge
Source Code - Modules and Functions in Python - Introduction to Tkinter
Source Code - Modules and Functions in Python - TkInter - Pack Geometry Manager
Source Code - Modules and Functions in Python - TkInter - Grid Geometry Manager
Source Code - Modules and Functions in Python - Advanced GUI Example Part 1
Source Code - Modules and Functions in Python - Advanced GUI Example Part 2
Source Code - Modules and Functions in Python - Advanced GUI Example Part 3
Source Code - Modules and Functions in Python - Tkinter Challenge
Source Code - Modules and Functions in Python - Functions in Python
Source Code - Modules and Functions in Python - Functions Part 2
Source Code - Modules and Functions in Python - Functions Part 3
Source Code - Modules and Functions in Python - Parabola - More on Functions
Source Code - Modules and Functions in Python - Scope in Functions
Source Code - Modules and Functions in Python - Fix Function and Draw Circles
Source Code - Modules and Functions in Python - Enhanced Circles and Challenge
Source Code - Modules and Functions in Python - Blackjack Setup
Source Code - Modules and Functions in Python - Blackjack Setup - PNG CARD IMAGES
Source Code - Modules and Functions in Python - Blackjack Setup - PPM CARD IMAGES
Source Code - Modules and Functions in Python - Load Cards
Source Code - Modules and Functions in Python - Deal Cards
Source Code - Modules and Functions in Python - Global Variables
Source Code - Modules and Functions in Python - Global Keyword
Source Code - Modules and Functions in Python - Test Blackjack Game
Source Code - Modules and Functions in Python - Blackjack Challenge
Source Code - Modules and Functions in Python - Importing Techniques
Source Code - Modules and Functions in Python - Underscores in Python code
Source Code - Modules and Functions in Python - Namespaces, more on Scope and Recursion
Source Code - Modules and Functions in Python - Nonlocal keyword, Free and LEGB
10. Object Oriented Python
Source Code - Object Oriented Python - Object Orientated Programming and Classes
Source Code - Object Oriented Python - Instances, Constructors, Self and more
Source Code - Object Oriented Python - Class Attributes
Source Code - Object Oriented Python - Methods Part 1
Source Code - Object Oriented Python - Methods Part 2
Source Code - Object Oriented Python - Non Public and Mangling
Source Code - Object Oriented Python - DocStrings and Raw Literals
Source Code - Object Oriented Python - Album class and More on DocStrings
Source Code - Object Oriented Python - Artist class and import Albums
Source Code - Object Oriented Python - Load data and Write Checkfile
Source Code - Object Oriented Python - Compile Files and Algorithm Flowcharts
Source Code - Object Oriented Python - Implement Revised Load_Data Algorithm
Source Code - Object Oriented Python - Write OOP Version
Source Code - Object Oriented Python - Getters and Properties
Source Code - Object Oriented Python - Remove Circular References Challenge
Source Code - Object Oriented Python - Getters and Setters
Source Code - Object Oriented Python - Data Attributes and Properties
Source Code - Object Oriented Python - Alternate Syntax for Properties
Source Code - Object Oriented Python - Inheritance
Source Code - Object Oriented Python - Subclasses and Overloading
Source Code - Object Oriented Python - Calling Super Methods
Source Code - Object Oriented Python - Changing Behavior of Methods
Source Code - Object Oriented Python - Overriding Methods
Source Code - Object Oriented Python - Inheritance Challenge
Source Code - Object Oriented Python - Polymorphism
Source Code - Object Oriented Python - Duck Test
Source Code - Object Oriented Python - Composition
Source Code - Object Oriented Python - Composition Continued
Source Code - Object Oriented Python - Test Code and Challenge
Source Code - Object Oriented Python - Aggregation
11. Databases
Source Code - Using Databases in Python - SQL in Python
Source Code - Using Databases in Python - Connections, Cursors and Transactions
Source Code - Using Databases in Python - SQL Injection Attacks
Source Code - Using Databases in Python - Placeholders and Parameter Substitution
Source Code - Using Databases in Python - Exceptions
Source Code - Using Databases in Python - Exceptions Challenge
Source Code - Using Databases in Python - Exceptions Continued
Source Code - Using Databases in Python - Raising Exceptions
Source Code - Using Databases in Python - More on Exceptions
Source Code - Using Databases in Python - Custom Exceptions
Source Code - Using Databases in Python - Rolling back Transactions
Source Code - Using Databases in Python - Adding Database code to the Account Class
Source Code - Using Databases in Python - Intellij's Database Viewer
Source Code - Using Databases in Python - Community Edition Database Plugin
Source Code - Using Databases in Python - Update Deposit and Withdrawal Methods
Source Code - Using Databases in Python - Displaying Time in Different Timezones
Source Code - Using Databases in Python - SQLite3 strftime Function
Source Code - Using Databases in Python - Challenge
Source Code - Using Databases in Python - Problem Storing Timezones
Source Code - Using Databases in Python - Rolling Back Transactions
Source Code - Using Databases in Python - GUI Database Viewer Setup
Source Code - Using Databases in Python - Scrollbars
Source Code - Using Databases in Python - Star Args
Source Code - Using Databases in Python - KWArgs
Source Code - Using Databases in Python - More on KWArgs
Source Code - Using Databases in Python - Scrollable Listbox
Source Code - Using Databases in Python - Populating a Listbox from a Database
Source Code - Using Databases in Python - Show Songs from Album
Source Code - Using Databases in Python - The DataListbox Class Code
Source Code - Using Databases in Python - Linking our DataListBoxes
Source Code - Using Databases in Python - Linking our DataListBoxes Continued
Source Code - Using Databases in Python - DataListbox Challenge
12. Generators, Comprehensions and Lambda Expressions
Source Code - Generators, Comprehensions and Lambda Expressions - Generators and Yield
Source Code - Generators, Comprehensions and Lambda Expressions - Next and Ranges
Source Code - Generators, Comprehensions and Lambda Expressions - Generator Examples
Source Code - Generators, Comprehensions and Lambda Expressions - List Comprehensions
Source Code - Generators, Comprehensions and Lambda Expressions - Challenge Solutions
Source Code - Generators, Comprehensions and Lambda Expressions - Conditional Comprehensions
Source Code - Generators, Comprehensions and Lambda Expressions - Conditional Expressions
Source Code - Generators, Comprehensions and Lambda Expressions - Challenges
Source Code - Generators, Comprehensions and Lambda Expressions - Challenge 1 Solution
Source Code - Generators, Comprehensions and Lambda Expressions - Challenge 2 Solution
Source Code - Generators, Comprehensions and Lambda Expressions - Nested Comprehensions
Source Code - Generators, Comprehensions and Lambda Expressions - Nested Comprehensions Challenge
Source Code - Generators, Comprehensions and Lambda Expressions - The timeit Module
Source Code - Generators, Comprehensions and Lambda Expressions - More on timeit
Source Code - Generators, Comprehensions and Lambda Expressions - timeit Continued and Challenge
Source Code - Generators, Comprehensions and Lambda Expressions - timeit Challenge
Source Code - Generators, Comprehensions and Lambda Expressions - Map Intro
Source Code - Generators, Comprehensions and Lambda Expressions - Map Challenge Completion
Source Code - Generators, Comprehensions and Lambda Expressions - The Filter Function
Source Code - Generators, Comprehensions and Lambda Expressions - The Reduce Function
Source Code - Generators, Comprehensions and Lambda Expressions - any and all
Source Code - Generators, Comprehensions and Lambda Expressions - Named Tuples
Source Code - Generators, Comprehensions and Lambda Expressions - any and all with Comprehension
13. Big O notation
Source code - Big O notation - Bubble sort
Source code - Big O notation - Big O of Bubble sort, and an optimisation
Source code - Big O notation - Big O of our improved Bubble sort
Source code - Big O notation - Bubble sort optimisation
Source code - Big O notation - Best, worst and average cases
Course in Progress
Source code - Reading and writing files in Python - Reading from a text file
Source code - Reading and writing files in Python - Opening a file using `with`
Source code - Reading and writing files in Python - read, readline and readlines
Source code - Reading and writing files in Python - strip, lstrip and rstrip
Source code - Reading and writing files in Python - removeprefix and removesuffix in Python 3.9
Source code - Reading and writing files in Python - Parsing data in a text file
Source code - Reading and writing files in Python - Working with text data
Source code - Reading and writing files in Python - Solution to capital city challenge
Source code - Reading and writing files in Python - Dictionary values with multiple keys
Source code - Reading and writing files in Python - Printing data to a text file
Source code - Reading and writing files in Python - Writing data to a text file
Source code - Reading and writing files in Python - Unicode in Python
Source code - Reading and writing files in Python - File encodings
Source code - Reading and writing files in Python - Serializing data using JSON
Source code - Reading and writing files in Python - Limitations of JSON
Source code - Reading and writing files in Python - Practical application - parsing JSON data
ARCHIVED-Program Flow Control in Python
Source Code - Program Flow Control in Python - Challenge - If Then Else
Source Code - Program Flow Control in Python - For Loops
Source Code - Program Flow Control in Python - Extending For Loops
Source Code - Program Flow Control in Python - Understanding Continue, Break And Else
Source Code - Program Flow Control in Python - Augmented Assignment
Source Code - Program Flow Control in Python - Challenge - Program Flow - Part 1
Source Code - Program Flow Control in Python - Challenge - Program Flow - Part 2
Source Code - Program Flow Control in Python - While Loops
Source Code - Program Flow Control in Python - Challenge - While Loop
ARCHIVED-Lists, Ranges & Tuples
Source Code - Lists, Ranges & Tuples - Lists In Python
Source Code - Lists, Ranges & Tuples - More About Lists
Source Code - Lists, Ranges & Tuples - Challenge - Lists
Source Code - Lists, Ranges & Tuples - Understanding Iterators
Source Code - Lists, Ranges & Tuples - Understanding and using Ranges
Source Code - Lists, Ranges & Tuples - More About Ranges
Source Code - Lists, Ranges & Tuples - Ordered Sets With Tuples
Source Code - Lists, Ranges & Tuples - More On Ordered Sets With Tuples
ARCHIVED-Binary Number System
Source Code - The Binary number system explained - Hexadecimal and Octal and the Challenge
ARCHIVED-Python Dictionaries and Sets
Source Code - Python Dictionaries and Sets - Python Dictionaries
Source Code - Python Dictionaries and Sets - Dictionaries Part 2
Source Code - Python Dictionaries and Sets - Dictionaries Part 3
Source Code - Python Dictionaries and Sets - Dictionaries Challenge
Source Code - Python Dictionaries and Sets - More on Dictionaries
Source Code - Python Dictionaries and Sets - The Second Dictionary Challenge Unsolved
Source Code - Python Dictionaries and Sets - The Second Dictionary Challenge
Source Code - Python Dictionaries and Sets - Sets
Source Code - Python Dictionaries and Sets - Python Sets Part 2 and Challenge
Course Challenges
Section 6
Section 7
Section 8
Section 9
Section 10
Section 11
Section 12