Smiling student in front of red heart representing Programming for Lovers brand

The last coding course you’ll ever need

Carnegie Mellon quality. 100% free.

Programming for Lovers is an open online course where you write code to answer real scientific questions, built on award-winning teaching from Carnegie Mellon University.

Most coding courses just don’t stick. Ours does: through compelling applications, guided code alongs, and practical exercises, all using a proven step-by-step approach.

The last coding course you’ll ever need

Carnegie Mellon quality. 100% free.

Programming for Lovers is an open online course where you’ll write code to answer real scientific questions, built on award-winning teaching from Carnegie Mellon.

Most coding courses just don’t stick. Ours does: through compelling applications, guided code alongs, and practical exercises, all using a proven step-by-step approach.


Explore the course

Programming for Lovers Euclid programming chapter header

Chapter 0

Programming for Lovers Euclid programming chapter header

Chapter 0

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.

Programming for Lovers bacteria chapter header

Chapter 1

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.

Programming for Lovers bacteria chapter header

Chapter 1

Chapter 2

Chapter 2

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.

Chapter 3

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 a automaton capable of self-replication.

Chapter 3


Watch our introductory video


Hear from our learners

“P4❤️ is a privilege”

Having access to well-written material and hands-on coding videos within the same resource is fantastic, and now everyone with access to the internet has this privilege. “Go” ahead and use it!

Bengisu Kandemir
Bengisu, Molecular Biologist

“Become a stronger programmer”

P4❤️ helped me make the leap from spaghetti code to a systematic problem-solving approach for programming.

Ben Kleyner
Ben, Undergraduate Student

“Engaging, Enjoyable, and Captivating”

P4❤️ creatively combines the foundations of coding with a scientific twist! It paved the way for my future as a computational biologist.

Sarah Baalbaki
Sarah, Master's Student

“Accessible and rigorous”

P4❤️ incrementally builds your knowledge, with each chapter using engaging questions that push your abilities, teaching you to solve complex problems systematically.

Ethan Gaskin
Ethan, Master's Student

“Truly a unique gift”

With excellent videos and fascinating scientific applications, P4❤️ is impossible not to love.

Chantal, High School Student

Sign up for our mailing list

Scroll to Top