Computer Science, asked by noobgaming0202z, 1 month ago

Given list L=[10,20,30,40,50,60,70] . What will output of the L[-3:88] ? ​

Answers

Answered by ankurdubey40
0

ahsgscvsvsvsbsbsvhevr CD rj

Answered by dreamrob
0

Given:

L=[10,20,30,40,50,60,70]

print(L[-3:88])

Output:

[50, 60, 70]

Explanation:

List indexing:

Elements: 10  20  30  40  50  60  70

Index:        0    1     2    3    4     5    6  

Negative indexing:

Elements: 10  20  30  40  50  60  70

Index:       -7   -6   -5   -4    -3   -2   -1

In this we have considered negative indexing.

Since we have only 7 elements in the list, therefor is we can only print till the last element.

So, in instruction L[-3:88], we will start from index -3 and go till the last of the list.

So, output is [50, 60, 70]

Similar questions