I've written the solution in Python. The first image is the code, and the second image is an example of me running it :)
9.0m questions
11.6m answers