Hi im just wondering what the 4 would do in this code
for y in range(0, height, 4):
Thanks
Hi im just wondering what the 4 would do in this code
for y in range(0, height, 4):
Thanks
Range with just one parameter: end.
Range with two parameters: start, end.
Range with three parameters: start, end, step.
So in your specific case
for y in range(0, height, 4)
0, 4, 8, ..., n, where n < height.
The 4 in the range function used in the for loop indicates the increment step. suppose the value of height is 20. Then the values for y will be set as 0, 0+4=4, 4+4=8, ... till 20 in subsequent iterations of the for loop.
For a more detailed description of range function check out the python documentation at: http://docs.python.org/2/library/functions.html#range
plus 4 each time you hit the range. For example,
for y in range(0, 14, 4)
you will get 0, 4, 8, 12