Autoplay
Autocomplete
Previous Lesson
Complete and Continue
Learn to Code with Python
Setup & Introduction
Welcome to the Python Programming Language (12:00)
macOS - Use the Terminal to Issue Commands to Your Operating System (9:40)
macOS - Download and Install Python 3 (9:11)
macOS - Download Course Materials
macOS - Install Visual Studio Code and Python Plugins (27:37)
macOS - Troubleshooting File Output
Windows - Using the Command Prompt (10:00)
Windows - Download and Install Python 3 (7:20)
Windows - Download Course Materials
Windows - Install Visual Studio Code and Python Plugins (22:15)
Windows - Troubleshooting File Output
FREE DOWNLOAD: Learn to Code with Python Course Notes PDF
The Visual Studio Code (VSCode) Interface and Helpful Shortcuts (12:44)
The Interactive Prompt (REPL) (7:32)
QUIZ: Setup and Installation
Words of Motivation (12:39)
General Housekeeping
Welcome to Python
Objects: Strings (12:51)
Intro to Functions (5:53)
The print Function I: Outputting a Single Argument (8:03)
QUIZ: Strings and the print Function
The print Function II: Outputting Multiple Arguments (5:47)
The print Function III: Parameters and Arguments (17:46)
Comments (7:29)
ARTICLE: Intro to Coding Exercises
CODING EXERCISE: Outputting Text with the print Function
CODING EXERCISE SOLUTION: Outputting Text with the print Function (5:12)
QUIZ: Welcome to Python Section Review
Numbers, Booleans and Equality
Mathematical Expressions (10:42)
Division, Floor Division, and the Modulo Operator (7:07)
QUIZ: Mathematical Operators
The Boolean Data Type, The Equality Operator (==) and Inequality Operator (!=) (14:51)
Boolean Mathematical Operators (4:40)
QUIZ: Boolean Mathematical Expressions
The type Function (8:59)
QUIZ: The type function
Type Conversion with the int, float and str Functions (8:55)
Variables
Intro to Variables (14:44)
ARTICLE - Variable Naming Rules
CODING EXERCISE: Declaring Variables
CODING EXERCISE SOLUTION: Declaring Variables (4:21)
Multiple Variable Assignments (4:49)
Augmented Assignment Operator (6:52)
Collecting User Input with the input Function (12:07)
The NameError, ValueError, TypeError and SyntaxError Exceptions (11:10)
QUIZ: Variables, Inputs, and Errors
Functions
Intro to Functions (11:21)
Parameters and Arguments (7:12)
Positional Arguments and Keyword Arguments (5:42)
Declaring Return Values for Functions (3:08)
CODING EXERCISE: The Basics of Functions
CODING EXERCISE SOLUTION: The Basics of Functions (4:59)
Default Arguments (3:07)
CODING EXERCISE: Default Arguments
CODING EXERCISE SOLUTION: Default Arguments (6:35)
The None Type (4:11)
BONUS: Function Annotations (7:16)
Strings: The Basics
Length, Concatenation and Immutability (10:01)
CODING EXERCISE - Length, Concatenation and Immutability
CODING EXERCISE SOLUTION: Length, Concatenation, and Immutability (4:17)
String Indexing with Positive Values (8:46)
String Indexing with Negative Values (2:44)
QUIZ: String Indexing
CODING EXERCISE: String Indexing
CODING EXERCISE SOLUTION: String Indexing (4:28)
String Slicing I: Slicing by Range (12:26)
QUIZ: String Slicing I
String Slicing II: Slicing by Steps (8:30)
QUIZ: String Slicing II
CODING EXERCISE: String Slicing
CODING EXERCISE SOLUTION: String Slicing (5:39)
Escape Characters (10:07)
The in and not in Operators for Inclusion and Exclusion (6:21)
Strings: Methods
The find and index Methods (9:51)
The startswith and endswith Methods (4:31)
The count Method (3:21)
CODING EXERCISE: The find and count Methods
CODING EXERCISE SOLUTION: The find and count Methods (3:45)
The capitalize, title, lower, upper and swapcase Methods (7:22)
Boolean Methods for Strings (7:45)
QUIZ: Casing Methods for Strings
The lstrip, rstrip, and strip Methods (5:43)
The replace Method (3:48)
CODING EXERCISE: String Cleanup Methods
CODING EXERCISE SOLUTION: String Cleanup Methods (3:28)
The format Method (12:45)
Formatted String Literals (f-strings) (4:22)
Control Flow
REVIEW: The Boolean Data Type, Equality and Inequality (5:08)
The if Statement (9:02)
The bool Function (Truthiness and Falsiness) (6:49)
CODING EXERCISE: if Statements
CODING EXERCISE SOLUTION: if Statements (6:46)
The else Statement (6:15)
The elif Statement (11:19)
CODING EXERCISE: if, else, and elif
CODING EXERCISE SOLUTION: if, else, and elsif (4:00)
Conditional Expressions (Ternary Operator Equivalent) (5:24)
The and Keyword (7:04)
The or Keyword (4:58)
The not Keyword (5:21)
Nested if Statements (8:27)
QUIZ: More Boolean Evaluations
CODING EXERCISE: Multiple Conditions
CODING EXERCISE SOLUTION: Multiple Conditions (4:28)
The while Loop (15:01)
A Brief Intro to Recursion I (17:43)
A Brief Intro to Recursion II (16:13)
CODING EXERCISE: Recursion
CODING EXERCISE SOLUTION: Recursion (10:40)
Lists: The Basics
Intro to Lists (8:31)
CODING EXERCISE: Creating Lists
CODING EXERCISE SOLUTION: Creating Lists (3:33)
The in and not in Operators (7:09)
QUIZ: List Basics
Select a List Element by Positive or Negative Index Positions (8:12)
CODING EXERCISE: Indexing into List
CODING EXERCISE SOLUTION: Indexing Into list (6:00)
Slice Multiple Elements from a List (9:04)
CODING EXERCISE: Slicing Elements
CODING EXERCISE SOLUTION: Slicing Elements (3:27)
QUIZ: List Slicing
CODING EXERCISE: List Problems
CODING EXERCISE SOLUTION: List Problems (6:03)
Lists: Iteration
Iteration with the For Loop (13:37)
CODING EXERCISE: List Iteration
CODING EXERCISE SOLUTION: List Iteration (6:36)
Iteration with Conditional Logic (13:12)
CODING EXERCISE: More List Iteration
CODING EXERCISE SOLUTION: More List Iteration (9:10)
Iterate in Reverse with the reversed Function (8:03)
The enumerate Function (9:52)
CODING EXERCISE: The enumerate Function
CODING EXERCISE SOLUTION: The enumerate Function (6:35)
The range Function (8:17)
The break Keyword (5:50)
The continue Keyword (5:24)
Command Line Arguments with argv (8:06)
Debugging
Intro to Debugging with VSCode (11:12)
Step Over (8:21)
Step Into and Step Out (7:12)
Working through a Problem (15:42)
Lists: Mutation
Assign New Value at Index Position (5:54)
Assign New Values to List Slice (6:02)
CODING EXERCISE: Overwriting Elements in List
CODING EXERCISE SOLUTION: Overwriting Elements in a List (4:48)
The append Method (5:02)
CODING EXERCISE: Conditionals, Range, Enumerate
CODING EXERCISE SOLUTION: Conditional, Range, Enumerate (9:30)
Building A List Up From Another List (11:47)
CODING EXERCISE: Building A List Up
CODING EXERCISE SOLUTION: Building a List Up (3:40)
The extend Method (6:17)
The insert Method (4:28)
CODING EXERCISE: Adding Elements to List
CODING EXERCISE SOLUTION: Adding Elements to List (5:07)
The pop Method (4:59)
The del Keyword (3:23)
The remove Method (2:38)
The clear Method (1:16)
CODING EXERCISE: Removing Elements from a List
CODING EXERCISE SOLUTION: Removing Elements from a List (7:53)
The reverse Method (0:59)
The sort method (6:14)
Lists: Methods
The count Method (4:16)
The index Method (5:14)
CODING EXERCISE: Encrypt Message
CODING EXERCISE SOLUTION: Encrypt Message (14:04)
The copy Method (4:49)
The split Method on a String (8:55)
The join Method on a String (4:35)
CODING EXERCISE: The split and join Methods on Strings
CODING EXERCISE SOLUTION: The join and split Methods (7:53)
The zip Function (8:42)
QUIZ: List Methods
Multidimensional Lists (13:30)
QUIZ: Multidimensional Lists
CODING EXERCISE: Multidimensional Lists
CODING EXERCISE SOLUTION: Multidimensional Lists (5:52)
List Comprehensions I: The Basics (10:15)
List Comprehensions II: Filtering Results (11:07)
CODING EXERCISE: List Comprehensions
CODING EXERCISE SOLUTION: List Comprehensions (5:42)
Built-in Functions
The help Function (6:41)
The map Function (7:10)
The filter Function (4:03)
Lambda Functions (8:21)
CODING EXERCISE: map, filter and lambdas
CODING EXERCISE SOLUTION: map, filter and lambdas (8:41)
The all and any Functions (3:38)
The max and min Functions (2:22)
The sum Function (1:07)
CODING EXERCISE: The sum Function
CODING EXERCISE SOLUTION: The sum Function (3:20)
The dir Function (6:38)
The format Function (7:45)
QUIZ: Built-In Functions
Tuples
Intro to Tuples (7:35)
CODING EXERCISE: Declare Tuples
CODING EXERCISE SOLUTION: Declare Tuples (3:25)
Lists vs. Tuples (9:22)
Unpacking a Tuple I: The Basics (8:46)
Unpacking a Tuple II: Using * to Destructure Multiple Elements (9:45)
CODING EXERCISE: Unpacking a Tuple
CODING EXERCISE SOLUTION: Unpacking a Tuple (5:06)
Variable Number of Function Arguments with *args (11:33)
Unpacking Argument Lists to Functions (5:02)
Objects and References
Variables, Objects, and Garbage Collection (4:22)
Shared References with Immutable and Mutable Types (3:52)
Equality vs Identity (The is and not is Keywords) (5:00)
Shallow and Deep Copies (9:04)
Dictionaries: The Basics
Intro to Dictionaries (14:03)
CODING EXERCISE - Create a Dictionary
CODING EXERCISE SOLUTION: Create a Dictionary (4:00)
Access a Dictionary Value by Key or with the get Method (8:22)
The in and not in Operators on a Dictionary (7:31)
Add or Modify Key-Value Pair in Dictionary (16:02)
The setdefault Method (4:18)
CODING EXERCISE: Dictionaries from Lists
CODING EXERCISE SOLUTION: Dictionaries from Lists (13:52)
The pop Method (8:13)
QUIZ: Dictionary Basics
CODING EXERCISE: Inclusion and Removal
CODING EXERCISE SOLUTION: Inclusion and Removal (2:54)
The clear Method (2:47)
The update Method (3:44)
The dict Function (3:14)
Nested Dictionaries (11:48)
Dictionaries: Iteration
Iterate over a Dictionary with a for Loop (9:08)
The items Method (5:34)
CODING EXERCISE: The items Method
CODING EXERCISE SOLUTION: The items Method (7:23)
The keys and values Methods (6:30)
CODING EXERCISE: The keys and values Methods
CODING EXERCISE SOLUTION: The keys and values Methods (2:44)
The sorted Function (5:10)
Lists of Dictionaries (5:42)
CODING EXERCISE: Nested Data Structures
CODING EXERCISE SOLUTION: Nested Data Structures (4:08)
Keyword Arguments (15:09)
Unpacking Argument Dictionary (6:06)
QUIZ: Keyword Arguments
CODING EXERCISE: Keyword Arguments
CODING EXERCISE SOLUTION: Keyword Arguments (3:39)
Dictionary Comprehensions I (8:50)
Dictionary Comprehensions II (4:33)
CODING EXERCISE: Dictionary Comprehensions
CODING EXERCISE SOLUTION: Dictionary Comprehensions (7:03)
Sets
Intro to Sets (13:48)
The set Function (6:08)
CODING EXERCISE: Set Basics
CODING EXERCISE SOLUTION: Set Basics (3:53)
The add and update Methods (3:15)
The remove and discard Methods (3:16)
The intersection Method (4:11)
The union Method (2:19)
The difference Method (3:08)
The symmetric_difference Method (3:23)
The issubset and issuperset Methods (5:45)
The frozenset Object (3:51)
Modules
Scripts, Modules and the import Keyword (11:34)
The Python Standard Library (The string, math and this Modules) (9:40)
The __name__ Special Variable (9:48)
Aliases wth the as Keyword (3:31)
Import Specific Attributes with the from Syntax (3:08)
Import All Attributes with * Syntax (3:42)
The __init__.py File I (11:24)
The __init__.py File II (4:50)
Reading and Writing to Files
Reading a File with the open Function and read Method (11:02)
Read File Line by Line with a for loop (3:19)
Write to a File (3:57)
Append to a File (3:07)
Decorators
Higher Order Functions I: Functions as Arguments (8:45)
CODING EXERCISE: Higher Order Functions
CODING EXERCISE SOLUTION: Higher Order Functions (5:04)
Nested Functions (8:23)
Higher Order Functions II: Functions as Return Values (6:18)
CODING EXERCISE: Higher Order Functions II
CODING EXERCISE SOLUTION: Higher Order Functions II (2:51)
Scope I: Global vs Local Variables (10:58)
Scope II: The LEGB Rule (6:06)
Scope III: Closures (3:07)
The global Keyword (3:33)
CODING EXERCISE: The global Keyword
CODING EXERCISE SOLUTION: The global Keyword (2:55)
The nonlocal Keyword (5:54)
Intro to Decorators (10:55)
Arguments with Decorator Functions (*args and **kwargs) (11:08)
Returned Values from Decorated Functions (3:44)
The functools.wraps Decorator (4:39)
Decorator Example from flask Library (6:21)
Classes: The Basics
Intro to Object-Oriented Programming (11:32)
Class Definitions and Instantiation (9:10)
CODING EXERCISE: Class Definitions and Instantiation
CODING EXERCISE SOLUTION: Class Definition and Instantiation (5:05)
The __init__ Method (10:14)
Adding Attributes to Objects (8:11)
Setting Object Attributes in the __init__ Method (11:14)
CODING EXERCISE: The __init__ Method
CODING EXERCISE SOLUTION: The __init__ Method (10:22)
Default Values for Attributes (7:50)
CODING EXERCISE: Default Values for Attributes
CODING EXERCISE SOLUTION: Default Values for Attributes (5:19)
QUIZ: The Basics of Classes
Classes: Attributes and Methods
Instance Methods (12:30)
CODING EXERCISE: Instance Methods
CODING EXERCISE SOLUTION: Instance Methods (7:30)
Protected Attributes and Methods (Encapsulation) (8:40)
CODING EXERCISE: Protected Attributes
CODING EXERCISE SOLUTION: Protected Attributes (5:15)
Define Properties with property Method (14:07)
Define Properties with Decorators (Alternate Approach) (6:14)
CODING EXERCISE: Properties
CODING EXERCISE SOLUTION: Properties (10:16)
The getattr and setattr Functions (9:42)
The hasattr and deleteattr Functions (4:43)
Class Methods (9:37)
CODING EXERCISE: Class Methods
CODING EXERCISE SOLUTION: Class Methods (4:55)
Class Attributes (7:48)
Attribute Lookup Order (3:53)
Static Methods (7:55)
QUIZ: Properties, Attribute Access, and Methods
Classes: Magic Methods
Intro to Magic Methods (7:38)
String Representation with the __str__ and __repr__ Methods (8:29)
Equality with the __eq__ Method (6:36)
Magic Methods for Comparison Operations (lt, gt, le, ge, add, sub) (7:23)
CODING EXERCISE: Equality and String Representation
CODING EXERCISE SOLUTION: Equality and String Representation (8:35)
Docstrings (7:51)
CODING EXERCISE: Docstrings
CODING EXERCISE SOLUTION: Docstrings (4:13)
Truthiness with the __bool__ Method (4:33)
The namedtuple Object (7:14)
CODING EXERCISE - namedtuple
CODING EXERCISE SOLUTION: namedtuple (5:04)
Length with the __len__Method (4:54)
Indexing with __getitem__ and __setitem__ Methods (12:23)
CODING EXERCISE: Custom Indexing and Iteration
CODING EXERCISE SOLUTION: Custom Indexing and Iteration (8:22)
The __del__ Method (4:15)
CODING EXERCISE: Magic Methods
CODING EXERCISE SOLUTION: Magic Methods (6:22)
Classes: Inheritance
Intro to Inheritance (5:10)
Define a Subclass (5:20)
CODING EXERCISE: Define a Subclass
CODING EXERCISE SOLUTION: Define a Subclass (2:53)
New Methods on Subclasses (5:11)
Override an Inherited Method on a Subclass (4:56)
CODING EXERCISE: Override a Method on Subclass
CODING EXERCISE SOLUTION: Override a Method on Subclass (6:47)
The super Function (16:29)
CODING EXERCISE: The super Function
CODING EXERCISE SOLUTION: The super Function (6:52)
Polymorphism I (6:10)
Polymorphism II (7:03)
CODING EXERCISE: Polymorphism
CODING EXERCISE SOLUTION: Polymorphism (8:39)
Name Mangling for Privacy (8:14)
Multiple Inheritance I: Method Resolution Order (7:53)
Multiple Inheritance II: Breadth First and Depth First Search (11:30)
Multiple Inheritance III: Diamond-Shaped Inheritance (7:06)
The isinstance Function and issubclass Function (8:52)
Composition (13:48)
Exception Handling
Introduction to Error Handling (3:25)
The try-except Block (8:13)
Catching One or More Specific Exceptions (7:23)
The raise Keyword (7:31)
User-Defined Exceptions (7:32)
Exception Inheritance Hierachies (9:22)
The else and finally Blocks (6:38)
QUIZ: Exceptions
Dates and Time
The date Object (7:40)
The time Object (6:15)
CODING EXERCISE: date and time Objects
CODING EXERCISE SOLUTION: date and time Objects (2:34)
The datetime Object I (11:19)
The datetime Object II: The strftime Method (6:13)
CODING EXERCISE: The datetime Object
CODING EXERCISE SOLUTION:The datetime Object (3:43)
The timedelta Object (7:08)
QUIZ: The date, datetime and timedelta Objects
The random Module
The random and randint Functions (5:49)
The choice and sample Functions (4:34)
The shuffle Function (5:37)
QUIZ: The random Module
Testing Code: The Basics
Introduction to Unit Testing (4:33)
The assert Statement (5:50)
The doctest Module (10:09)
The unittest Module (5:17)
The assertEqual Method (11:46)
The Purpose of Testing (7:07)
Skipping Tests and Expected Failures (5:38)
Assertions - assertNotEqual and Custom Error MEssages (6:42)
Assertions - Test Object Identity with assertIs and assertIsNot (3:15)
Assertions - Test Truthiness and Falsiness (assertTrue and assertFalse) (3:30)
Assertions - Test Nullness with assertIsNone and assertIsNotNone (2:19)
Assertions - Test Inclusion with assertIn and assertNotIn (5:47)
Assertions - Test Object Type with assertIsInstance and assertNotIsIstance (4:57)
Assertions - Test Errors with assertRaises (6:36)
The setUp and tearDown instance Methods (11:15)
The setUpClass and tearDownClass Methods (5:40)
Testing Code: Mocking
Intro to Mocking with the Mock Class (12:56)
The return_value Attribute (7:50)
The side_effect Attribute (9:38)
CODING EXERCISE: Creating Mocks
CODING EXERCISE SOLUTION: Creating Mocks (6:59)
The Mock vs MagicMock Objects (9:47)
Mock Calls (10:18)
Putting it All Together (14:49)
Verifying Doubles (13:19)
Patch I: The patch Function (21:30)
Patch II: The patch Decorator (4:07)
Patch III: What patch Patches (8:43)
Building A Card Game
Introduction to the Section + The Rules of Poker (21:33)
Test-Driven Development (TDD) (18:35)
Setting Up Our Project (10:44)
The Card Class I: Adding rank and suit Attributes (12:39)
The Card Class II: String Representation and Technical Representation (11:42)
The Card Class III: Adding all Ranks and Suits (15:10)
Building out the main.py Start File (4:00)
The Deck Class I: Storing and Adding Cards (16:34)
The Card Class IV: Creating 52 Cards (30:09)
The Hand Class I: The High Card Rank (21:36)
The Hand Class II: The Pair Rank (15:26)
The Hand Class III: The Two Pair Rank (12:38)
The Hand Class IV: The Three of a Kind Rank (7:09)
The Hand Class V: Refactoring (21:01)
The Hand Class VI: The Straight Rank (Part 1) (29:21)
The Hand Class VII: The Straight Rank (Part 2) (29:44)
The Hand Class VIII: The Flush Rank (10:55)
The Hand Class IX: The Full House Rank (5:30)
The Hand Class X: The Four of a Kind Rank (4:08)
The Hand Class XI: The Straight Flush Rank (9:18)
The Hand Class XII: The Royal Flush Rank (6:07)
Dependency Injection (15:11)
The Player Class I: Creating a Player with a Hand (17:41)
Catching Two Bugs (26:53)
The GameRound Class I: Instantiation and Card Shuffle (33:20)
The Deck Class II: Removing Cards (14:51)
The GameRound Class II: Asking the Deck for Cards (12:01)
Expanding Player and Hand Classes to Add New Cards (22:54)
The GameRound Class III: Sending Cards to the Players (13:59)
Manual Testing + Adding Hand Technical Representation and Deck Length (16:32)
Implementing Fake Betting in the Player and GameRound Classes (16:58)
Community Cards in Hand, Player and GameRound Classes (19:57)
The GameRound Class IV: Finishing Up Community Cards Logic (18:17)
Running the Code Again (6:21)
The HighCardValidator Class (28:23)
TheNoCardsValidator Class (10:30)
The PairValidator Class (22:50)
The TwoPairValidator Class (18:07)
Refactoring the Existing Validators (9:13)
The ThreeOfAKindValidator Class (13:48)
The StraightValidator Class I (25:00)
The StraightValidator Class II (9:53)
The FlushValidator Class (17:08)
The FullHouseValidator Class (16:00)
The FourOfAKindValidator Class (11:27)
The StraightFlushValidator Class I (16:06)
The StraightFlushValidator Class II (16:16)
The RoyalFlushValidator Class (18:43)
Refactoring the Hand Class (20:07)
Calculating the Winner (28:35)
Regular Expressions
Search for Text with a Pattern Object (11:36)
Search for Text at Beginning of String with the match Method (2:54)
The findall and finditer Methods (3:55)
Module-Level Regex Functions (2:39)
Review of Raw Strings (2:38)
Search for Digit and Non-Digit Characters (6:20)
Search for Word and Non Word Characters (1:54)
Search for Whitespace (1:06)
Search for Word Boundaries (3:23)
Metacharacters - The Dot (3:15)
Metacharacters - Square Brackets with Characters (4:38)
Declare Number of Matches with Curly Braces I (3:49)
Declare Number of Matches with Curly Braces II (6:25)
Search for One or More of a Character (2:59)
Matching One Character or Another (3:38)
Virtual Environments
Introduction to PyPi and Python Packages (11:53)
Introduction to pip and Virtual Environments (9:56)
MacOS - Create, Activate, and Deactivate Virtual Environment (13:50)
Windows - Create, Activate, and Deactivate Virtual Environment (12:07)
Install Python Packages with pip3 (11:33)
Uninstall Python Packages with pip (3:46)
Install Specific Version of Package or Upgrade Package (4:59)
Create requirements.txt File (9:37)
Web Scraping with Scrapy
Intro to Web Scraping and Installing Scrapy (6:12)
Create Scrapy Project (5:03)
Write First Scrapy Spider (15:31)
A Small Refactor (3:07)
A Quick Introduction to HTML and CSS (11:15)
The Scrapy Shell (17:15)
Writing to JSON File (6:22)
CHALLENGE: Add Book Prices to File (7:27)
Scraping Sequential Pages (14:03)
Conclusion
Thank You (1:31)
A Small Refactor
Lesson content locked
If you're already enrolled,
you'll need to login
.
Enroll in Course to Unlock