Search⌘ K

Problem Solving: The Bottle Filling Example

Explore how to solve measurement problems using simple bottles. Learn to break down tasks like measuring 2, 1, and 4 liters into clear steps, understand variables, and write programs. This lesson builds foundational problem-solving skills in Python through practical examples.

Eat an elephant one bite at a time

Even the longest journey requires us to take one step at a time. We write complex code to solve many computational problems. Those problems might look daunting now, but we just need to solve them step by step. To solve a complicated word problem, start by writing steps in simple English.

Measuring problems

We’ll start with a simple problem—measuring water with the help of two odd containers.

We only have two bottles, a ...