Hey guys, can someone explain to me how the range (start,stop,step) works?
I don't get how printing range(1,6,3) gets 1,4
So you start at 1 stop at 6 (not included) and go with a stepwidth of 3. So 1 is in, then 1+3=4 is in and 4+3 = 7 would be outside of the range so it's: 1,4. Or what do you mean?
oh so it does not literally add 3 to every single element? starting from 1 to 6 should be 1,2,3,4,5. But why does one itself is include in the outcome?
starting from 1 to 6 should be 1,2,3,4,5
That would be done by range(6) which has 1 as start and step by default or range(1,6)
But why does one itself is include in the outcome?
Guess its just convention, normally programmers start counting from 0.