Why rang(2,6) doesn't contain 6 itself? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why rang(2,6) doesn't contain 6 itself?

11th Mar 2017, 3:50 AM
Lu Huang
2 Answers
+ 4
Because the range ([start], stop [, step]) function does not include the last range value, which in your case is the number 6. When you want to include the last range number use range(2, 6+1).
11th Mar 2017, 4:31 AM
Kelvi Dalmazo
Kelvi Dalmazo - avatar
0
Thanks
11th Mar 2017, 4:46 AM
Lu Huang