
The last coding course you’ll ever need
Carnegie Mellon quality. Sign up for free!
Programming for Lovers is a free online course where you’ll write code to answer real scientific questions, built on award-winning teaching from Carnegie Mellon University.
Explore the course
Ancient Greek Math and the Foundations of Computer Science
An introduction to programming
Algorithms, or methods used to solve problems, are the building blocks of computer science. Although computers are relatively new in human history, algorithms are not, and we will learn about two beautiful mathematical algorithms from ancient Greece. We will introduce the basics of pseudocode, which allows us to precisely describe complex algorithms. We will then transition to learning a language, which we will use to implement and time the Greek algorithms to see just how fast they are.
Hunting for Hidden Messages in Bacterial Genomes
String algorithms
Every organism on Earth has a genome, or the sum total of its cellular DNA. Your own genome has three billion nucleotides, or letters from the four symbol alphabet {A, C, G, T}. The genome of a bacterium typically has a few million nucleotides. How can we decipher the hidden messages that are lurking within DNA? We will see that even relatively simple algorithms can provide deep insights into the life of a bacterium.
Forecasting a Presidential Election
Monte Carlo Simulation
We will introduce a powerful paradigm called Monte Carlo simulation that incorporates randomness into many simulated trials in order to estimate an outcome. After understanding the complexities of generating random numbers, we will apply what we learn to simulate the 2016 US presidential election from polling data and reflect on the pitfalls of forecasting.
Discovering a Self-Replicating Automaton
Top-Down Programming
Despite the many advances in AI and robotics, researchers have yet to build a robot that can both perform a complicated task and create a copy of itself. Yet the theoretical foundations of this idea lie decades in the past. We will introduce cellular automata, a simple model of cells, and after exploring one popular automaton called the Game of Life, we will see how to build an automaton capable of self-replication.

CHAPTER 4
Building a Gravity Simulator
Object Oriented Programming and Abstraction
In this next chapter, we will introduce object-oriented programming and abstraction and how we can define new types and represent concepts with small amounts of information. We will then simulate how a small universe of bodies moves under Newtonian gravity through exploring the three-body problem.










