Sensei's Library, problem 9

Adapted from Beginner Exercise 9 · OpenContent License

All problems