How to Find Common Elements of Two Lists in Python

Problem Formulation and Solution Overview In this article, you’ll learn how to locate and return the common elements of two (2) lists in Python. To make it more fun, we have the following running scenario: Bondi Brokers offers two (2) Marketable Bonds: 3-years and 5-years. Each yields different amounts. To determine which Bond best suits … Read more

The Maximum Profit Algorithm in Python

This article presents an algorithmic problem with practical value for stock market analysis. For instance, suppose you are trading the cryptocurrency Ethereum. How much profit in dollars can you make by buying low and selling high based on historical data? Maximum Profit Basic Algorithm The max profit algorithm calculates the maximum profit you’d obtain by … Read more

6 Ways to Get the Median of a Python List

Problem Formulation Given a Python list of integer or float numbers. How to calculate the median of a Python list? Formally, the median is β€œthe value separating the higher half from the lower half of a data sample” (wiki). Note that the median is different to the mean or average as can be seen in … Read more