Sensei's Library, problem 7

Adapted from Beginner Exercise 7 · OpenContent License

All problems