Sensei's Library, problem 13

Adapted from Beginner Exercise 13 · OpenContent License

All problems