
Launch jupyter notebooks locally with anaconda navigator on localhost to create your first Python notebook for Python Primer, run the hello world example, and begin learning Python basics like variables.
Define and print variables in Python primer course, exploring numbers and strings, learn how type checks reveal whether a value is an int or a string, and study reassignment.
Explore string functionality by initializing with single or double quotes, using plus for concatenation, formatting with placeholders, and converting between strings and numbers, noting that string and number addition fails.
Master zero-based string indexing with single indices and slices, including negative indices, and learn basic string utilities like length, lower and upper, find, and split.
Floating point numbers have a decimal part, as seen with a equals two point five and type float; you can assign values at once, like A equals B equals five.
Explore defining variables, converting between string and integer, incrementing values with +=, and formatting strings. Practice extracting a quote and its author by locating the dash and splitting the text.
Explore boolean values in Python, using true and false, convert to integers, and apply equals, not equals, and other comparison operators to drive program logic.
Use boolean values with if statements to control code execution in Python, and learn how indentation defines the running block for true conditions and how outdenting ends it.
Demonstrates nesting of if statements with indentation, using outer condition a < 10 and inner condition a < 8; the inner executes only when the outer is true.
Explore Python basics through problem set 2 solutions, defining numbers and booleans, printing values and types, and building if statements for ranges. Use nested if for 11–19 and debugging tips.
Explore lists in the Python primer, learning how to declare and initialize lists, access elements with zero-based indexing, determine length, and handle index out of range errors.
Learn how to use append to add elements to a Python list with in-place modification, single-argument behavior, and how it creates nested lists, then explore extend for multiple elements.
Learn how to manipulate lists in Python using extend to append multiple elements, and also use append, plus, plus equals, insert, and direct assignment to overwrite values.
Explore Python list operations by removing elements with remove and pop, including removing first instance, popping last or indexed elements, and clearing all items to reset the list.
Apply advanced list indexing in Python by using slice patterns to skip elements, set start and end, and control step size to obtain patterns like every second or third item.
Explore reverse ordering with negative indexing and locate first or subsequent indices in Python. Practice safe error handling when items are missing and using index with pop to retrieve values.
Learn to use Python list functions: count occurrences of a value, sort a list in place, and find the maximum and minimum with max and min, including reverse sorting.
Explore how Python repeats a list with integer multiplication, learn list comprehension syntax for x in L with f(x), and use modulo to compute remainders and filter results.
Learn to use the zip function to iterate two or more lists in parallel, with list comprehension, then review nested lists indexing and the range function for generating sequences.
Explore tuples in python primer, learn how parentheses create immutable ordered collections, and use count and index to query elements, comparing them to lists.
Explore how sets hold unique values, create them with curly braces, convert lists to sets for uniqueness, and use union, intersection, disjoint checks, and remove operations.
Explore python list operations through steps: create and modify lists with append, extend, remove, and pop; use range, indexing, list comprehensions, and analyze set overlap and divisible by three.
Explore how loops in Python enable iteration over data structures with for loops and range to print values, square numbers, and track sums, while loop variables reset each iteration.
Learn how nested loops behave, with an outer loop of five and an inner loop of three, producing 15 outputs via range, and how break stops loops.
Explore how the continue statement skips the rest of a loop and returns to the top, while using zip to pair list elements in for loops and handle nested lists.
compare the while loop to a for loop and explain its termination condition. warn about infinite loops and show examples that print values as they iterate.
Apply for loops to a nested list, assign rows, and print them, then add an inner loop with start and end via range, noting that the end is not inclusive.
Learn how to solve a Python primer problem by iterating values, checking divisibility with modulo, printing factors, incrementing a factor counter, and using a while loop until reaching K.
Define and call basic python functions using def, colon, and indentation; reuse code with named functions like say hello, print world, and call them multiple times.
Learn how to use arguments to enrich functions in Python, enabling different interactions by passing single or multiple values, and understand why missing arguments cause errors.
Learn how to use return to send a function’s result back to a variable instead of printing it, and see examples that compare values and switch the variables with return.
Default arguments let a function have a fallback value for parameters after regular ones, which can be overridden. The example with a and b shows defaulting and overwriting by value.
Explore function scope and see why local changes inside a function don’t persist outside unless you return and reassign, as shown when a is doubled.
Understand how mutable structures like lists persist changes when passed to functions, and copy the list using indexing or a copy method to avoid altering the original.
Explore nested functions by defining f2 inside f1 and applying it to a, doubling 3 to 6 and squaring to 36, showing definitions exist only within the outer function's scope.
Explore lambda functions in the Python primer, learn how lambda expresses a one-line function, with x squared examples, and when to use them for quick definitions.
Define a multiplier function that returns the product of three numbers, explore default arguments, and override values; implement a list-processing function that prints items and returns their sum.
Explore how Python dictionaries map keys to values with curly braces and colon syntax, access data via brackets, and handle missing keys in a first name and last name example.
Learn how to add and overwrite key-value pairs in a Python dictionary by assigning dict[key] = value, creating new keys or updating existing ones, and retrieving values.
Discover Python dictionaries by viewing keys and values with keys() and values(), iterating and converting to lists, and deleting pairs with del; learn that length counts the number of pairs.
Learn how to check keys in a Python dictionary, using 'key in dictionary' to return true or false, distinguish between keys and values, and guard indexing with if statements.
Create a dictionary print function that checks a key against dictionary keys and values, prints the corresponding value or key, and demonstrates with name and John while inviting experimentation.
Explore looping through dictionaries by iterating over keys or values, retrieving data by key, and using different key types such as integers, with guidance to keep key types consistent.
Create and populate a list and a dictionary with incremental keys, then print the maximum key and build a squares dictionary from 1 to 100, verifying squares by key-value relationships.
Docstrings describe a function’s behavior, arguments, return value, and types, and show how to use typing and type hints in Python function documentation.
Build a basic check valid function that prints valid, asserts value types (string, integer, or float), ensures values are between 0 and 100, and requires string length greater than one.
Define a class as a blueprint, then instantiate objects by calling the class to create instances like Carl and Jeff, illustrating initialization and basic class usage.
Define and use class functions by including self as the first parameter, so any instance can access the function; update existing instances by redefining them when the class changes.
Explore class attributes in Python primer, showing how a class-level age is shared by all instances, then use self to access and override per-instance ages without affecting others.
Implement class initialization with __init__(self, age) to set per-instance age and name. Enforce type checks with assertions and update age using set_age.
Define meaningful string representations with the __str__ method to customize how objects print, showing name and age. Extend behavior with subclasses, super initialization, and shared attributes from a base class.
Define a worker class in Python Primer with initialization of wage and hours, validate wage and hours with assertions, accumulate hours with work hours, compute earnings, and implement string representation.
Create a subclass of worker named Oteh worker with regular hours and wage, implement overtime checks, compute overtime hours, and calculate total wage with one point five times the rate.
Learn to use matt plot lib to plot a total cost function with fixed and variable costs, and add x label, y label, and a title.
Set axis limits with ylim and xlim to emphasize fixed costs and reveal the full graph; plot cost and revenue lines with Map Portland, and add a legend with labels.
Learn to color plot lines by passing a color argument (red, green, or black) for revenue, cost, and profit, with the legend updating automatically, and apply dashed or dotted styles.
Define lists with range 1 to 100 and compute y1, y2, y3. Plot them with matplotlib using red, blue, and green, then add a legend, title, and axis labels.
This course is the first in a series of courses from FinanceAndPython. It works through the basics of python and how to write your first scripts. Upon completion you will be able to move on to some of the more advanced courses such as Basic Finance, Data Science, Investments, and more! The way that this course is taught is through a learning by doing model. You will be able to follow along as coding is done live in jupyter notebooks. Problem sets are also provided with solutions for each of the sections and a github repository with all of the course notebooks. To succeed in this course it is recommended to code along and begin experimenting with your own code.
The structure of the course is:
1. Variables: The basic building blocks of programming which hold information
2. If Statements & Boolean Values: Adding in ways to understand truth in statements and act on them
3. Lists, Sets and Tuples: Data structures for holding variables
4. Loops: Building intuition of how to iterate over sets of data
5. Functions: Creating repeatable patterns of code
6. Dictionaries: Branching out to a new data structure
7. Assertions and Docstrings: Building defensive and well explained code
8. Classes: Creating templates of objects
9. Matplotlib: Visualizing data