What will be the output for following statement?
list1 = [1, 2, 3, 4, 5]
list1 [ len (list1)-1]
Answers
Answered by
2
Answer:
The statement in line 2 has a negative step size. This means that the list will be traversed in reversed order with step size 2.
OUTPUT: [10, 8, 6, 4, 2]
The statement in line 3 will print the complete list. i.e. [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
This will print the last element of the list. i.e. 5
Hope my answer will help you...
Similar questions
English,
29 days ago
English,
29 days ago
Math,
29 days ago
Math,
1 month ago
Computer Science,
7 months ago
Social Sciences,
7 months ago
Geography,
7 months ago