If List = [1, 2,3,4,5,6,7,8,9,10] then print List[8:4:-1] will give
Answers
Answered by
0
If List = [1, 2,3,4,5,6,7,8,9,10] then print List[8:4:-1] will give [9,8,7,6]
Explanation:
- The numbers 8,4 are the indexes of the given list.
- The order in which the list gets reversed, is given by the number at the third position that is -1.
- Hence List [8] refers to the number 9 since the index starts from 0.
- From the List, four elements (including 9) that are in the left of 9 are 9,8,7,6.
- Hence the result is [9,8,7,6].
Similar questions