• + 1 comment

    range() is inclusive of the first number (which is 0, by default), but exclusive of the last one. So "for i in range(5): print i" will give you 0,1,2,3,4 (but not five). In this case, we want to also include the number given, hence the +1. The 0 for the first part range(0,5), is optional, since we are starting at the beginning.