You are viewing a single comment's thread. Return to all comments →
what is the reason for x+1 y+1 and many more
In simple words it signifies that the range is inclusive of max limit
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.
in python iteration occurs one less than the give variable