Sensei's Library, problem 140

Adapted from Beginner Exercise 140 · OpenContent License

All problems