I. Python Programming

Introduction to Python & Programming

Introduction to Python & Programming 12 results
OrderFile NameComments
1What is programming and PythonBrief notes on what is programming and python, as well as an overview of thee computer architecture.
2Types of ErrorsUnderstanding syntax, logic, and semantic errors.
4Python VariablesOverview of Python variables, how to assign values to a variable, and naming convention.
5Python Data TypesOverview of basic Python data types (numeric, string, collection, and boolean).
6Python IterablesIterable objects in Python (lists, dictionary, tuples)
7Python Indexing and SlicingHow to retrieve elements in an `iterable object` using **indexing**.
8Python CommentsCommenting code using `#` and creating multi-line comments.
9Debugging TipsTips on test cases and using python's `assert` statement.
10Copying in Python and AliasingUnderstanding shallow vs deep copies in Python and why you should not use the assignment operator for copying mutable objects.
11Common Keywords and OperatorsOperators: `in`, `not in`, `is`, `is not`. Keyword definitions: `None`.
12Python Modules and LibrariesWhat are python libraries, and how to import modules. Renaming modules with an alias.
13Type ConversionsImplicit vs explicit type conversions.

Python Data Types

Python Data Types 2 results
OrderFile NameComments
1Boolean Values and ExpressionTypes of Boolean Expression and Evaluating Booleans
2Python StringsWhat are strings, common methods and operations, reversing strings, string comparisons, and string formats.

Python Data Structures

Data structures in Python are built-in or user-defined structures that allow you to store, organize, and manipulate data efficiently. There are 4 main types of built-in data structures[1] in python.

Summary of Python built-in data structures:

Data Structure Definition Ordered Mutable Allows Duplicates Key-Value Pairs Unique Elements
List Ordered collection of elements Yes Yes Yes No No
Dictionary Unordered collection of key-value pairs No Yes Keys: No, Values: Yes Yes No
Set Unordered collection of unique elements No Yes No No Yes
Tuple Ordered collection of elements Yes No Yes No No

Python Lists

Using Lists as an Argument for a Parameter

When you pass a list into a function, the function gets a reference to the list (not a copy). Since lists are mutable, any changes made to the elements referenced in that parameter of a function will change the original list. Important to create a new list: new_list = old_list[:]

Python Lists 7 results
OrderFile NameComments
1Creating a ListCreating an empty list using `[]` and `list()` constructor method.
1About Python ListsWhat is a python list? How do we create a list and retrieve elements in a list?
3Changing Elements in a ListsHow to change all and specific elements of a Python List.
4Copying ListsHow to avoid "aliasing" when copying lists where you have multiple variables referencing the same object in memory. Want to create an independent copy of the list using `copy()` or slicing.
5List ComprehensionShort-handed notation for creating a new list based on an existing iterables.
6Concatenating ListsConcatenating lists using the `+` operator or the `extend()` method.
9Multidimensional (Nested) ListsOverview and how to create a user-defined matrix and how to index for specific elements.
Lists Methods
List Methods 6 results
OrderFile NameComments
1Adding Elements in a ListMethods used to add elements in a list: `append()`, `insert()`.
2Removing Elements in a ListMethods used to remove elements in a list: `remove()`, `pop()`, and `del()`.
3`Insert()` MethodHow to insert an element at a specified position in a list. Basic Syntax for the `insert()` method.
4`sort()` MethodSorting a list "in-place", without creating a new list.
5`sorted()` MethodCreate a new sorted list from an existing list. Does not sort "in-place".
6`join()` Method

Python Dictionaries

Python Dictionaries 8 results
OrderFile NameComments
1About Python DictionariesHow to create an instance of a `dictionary` and clear a dictionary.
2Accessing Key and Values in a DictionaryAccessing key/values in a dictionary using the `get()`, `items()`, 'keys()` and `values()`.
3Adding and Removing ItemsHow to modify, add, or remove a key-value pair in a dictionary.
4Sorting a DictionaryHow to sort by keys and values within a dictionary, and custom sorting with `lambda` functions.
5Counting Using DictionariesHow to use a dictionary to count items. Sample syntax.
6Counting Occurrence of Words in a Text FileHow to use dictionaries to count the occurrence of words in a text file.
7Indexing a Nested ListHow to index values of a nested dictionary by its key.
8Looping Through DictionariesIterating through dictionaries by `key`, `value`, or `key:value` pair.

Python Tuples

Python Tuples 3 results
OrderFile NameComments
1About Python TuplesTuples are essentially unmodified versions of a `List`. Once created, it cannot be changed. As a result, there are no methods that can add or remove items in a tuple.
2Accessing Tuple ElementsIndexing and slicing elements in a tuple.
3Tuple Unpacking (Multiple Assignment)How to assign values to multiple variables in a single line. Can be used in conjunction with tuples, lists, or other iterable types.

Python Sets

Python Sets 6 results
OrderFile NameComments
1About Python SetsBased on set theory.
2Set UnionUsing sets and the `union()` method to retrieve the unique elements of 1 or more iterable objects.
3Set IntersectionHow to retrieve elements that exists in 1 or more iterable objects.
4Set DifferenceRetrieving elements found exclusively in one specified set.
5Superset and SubsetsComparing relationships between sets with respect to `superset` and `subset`.
6Symmetric DifferenceSet difference returns only the elements not found in se

Python Functions

Python Functions 9 results
OrderFile NameComments
1About Python FunctionsHow to call functions, passing arguments in a function, and the 2 main types of function: (1) User-defined functions, and (2) built-in functions.
2User-Defined Functions & Type AnnotationsGeneral structure of defining your own function and type annotations in specifying the function's parameter type and return type.
3Lambda ExpressionsAnonymous functions with `lambda` expressions.
4DocstringsCreating string literals that appear right after the definition of a function (also applicable to method, class, or a module).
5Function CompositionsConcept of combining two or more functions to create a new function, where the output of one function becomes the input for another.
6Nested FunctionConcept of defining a function within another function and definitions of `local`, `nonlocal`, and `global` variables in the context of accessing variables.
7Local and Global VariablesSummary of local, nonlocal, and global variables.
8Arguments and ParametersParameter is the variable defined in a function. Argument is the value that is passed through the function when it is called, assigned to the corresponding parameter defined inside the function.
9Return ValuesUsing the `return` keyword to pass the result or value of a function invoked back to the caller. A function with a return statement is referred to as a "fruitful" function.

Python Loops

Python Loops 6 results
OrderFile NameComments
1About Python LoopsOverview of for and while loops, how the number of iterations are defined.
2For LoopUnderstanding the structure and flow of a for loop and how to create a for loop.
3While LoopsStructure and flow of execution for a while loop. Also how to execute while loops without a boolean expression.
4Keywords Within Loops`Break`, `Continue` keywords to exit out of the loop or skip to the next iteration of the loop.
5Infinite LoopsWhat happens when the while loop always evaluates to `True`.
6Input-Controlled LoopsControlling while loops based on user-input.

Python Conditionals

Python Conditionals 7 results
OrderFile NameComments
1About Python Conditional Statements
2Logical Connectives (Operators)Brief overview of `AND`, `OR`, and `NOT` logical connective and corresponding truth table.
4The IF StatementBasic structure of one-way IF statements and why **indentation** is important.
5The IF-ELSE StatementConstructing a Two-Way IF Statement
6The IF-ELIF-ELSE StatementIf statements for more than 2 possible outcomes.
7Nested ConditionsCreating nested conditions under `IF` or `ELSE` block.
Comparison Operators

Python Classes & Inheritance

Python Classes & Inheritance 6 results
OrderFile NameComments
1About Python Classes and InheritanceDefinitions for class and inheritance, and understanding attributes and behaviours of a class.
2Creating a ClassHow define the class structure, its methods and attributes. Constructing an instance of the class by calling the class.
3Class vs Instance VariablesHow to define variables shared among ALL class vs variables specific to an instance of the object.
4The __init__() Constructor FunctionMore information on the constructor function
5Class InheritanceHow to create a class that inherits all the methods and properties of another class (parent). Does **not** introduce their own.
6Creating SubclassesHow to create a child class that inherits all the parent properties and methods, but also introduces its own properties and methods. How to override a parent method.

Python Try-Except

Python Try-Except 3 results
OrderFile NameComments
1About Try-ExceptHow to deal with run-time error using `Try/Except` without the program crashing.
2Raising an ExceptionUsing the `raise` exception statement to signal a run-time error has occurred during the execution of the program. Often used for handling edge cases or for testing scenarios where you may intentionally raise an exception.
3Additional Keywords`Else` to define a block of code to be executed if no errors were raised. `Finally` to define a block of code to be executed regardless of whether an error is raised or not.

Python File Handling

Python File Handling 6 results
OrderFile NameComments
1About Python File HandlingOverview of how to open and read files.
2Getting the FileWhat to do if the file is not in the same directory as the Python program and how to get the file path.
3Writing to a FileWriting to a file in `w` or `a` mode using `write()` or `writelines()`.
4Closing a FileClosing a file.
5File Handling Using With
6Exporting to a FileExporting a DataFrame to a particular file (CSV, xlsx, JSON, parquet, to a SQL database)

Useful Miscellaneous Codes

Useful Miscellaneous Codes 3 results
OrderFile NameComments
1User InputHow to prompt users for an input.
2The Zip() FunctionHow to combine elements from two or more iterable objects based on their corresponding positions.
3The Map() and Filter() FunctionUsing `map()` to apply a function to each element in a iterable. Using `filter()' to filter for elements in an iterable based on the result of a function applied.

  1. A data structure refers to a way of organizing and storing data in a computer's memory or storage system. ↩︎

Powered by Forestry.md