It's always a good idea to check out some documentation if you're unsure how a funciton or class works. For instance, check out the range().
You can see that range(start, stop, step) has 3 arguments: start, stop and step. The first element is start, but stop is never actually reached. Hence if you do want stop to be reached, you need to provide a new end, hence the writer of the code did stop + 1.
I hope this helped.