Why are not taking last indexing number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why are not taking last indexing number?

squares = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] print(squares[2:6]) [4,9,16,25] Why are not taking 6 indexing number (36)

10th May 2020, 12:15 PM
Pradumn Kumar Maurya
1 Answer
+ 4
start index is included but not the end so if u have array[5:10] it will give element start from index 5 till index 9
10th May 2020, 12:23 PM
durian
durian - avatar