Python Flashcards
1
Q
lst=[10, 20, 30, 40, 50]
lst[:-1]
A
[10,20,30,40]
2
Q
lst=[10, 20, 30, 40, 50]
lst[1:-1]
A
→[20,30,40]
3
Q
lst=[10, 20, 30, 40, 50]
lst[::2]
A
lst[::2]→[10,30,50]
4
Q
lst=[10, 20, 30, 40, 50]
lst[::-1]→
A
lst[::-1]→[50,40,30,20,10]
5
Q
lst=[10, 20, 30, 40, 50]
lst[::-2]→
A
lst[::-2]→[50,30,10]
6
Q
lst=[10, 20, 30, 40, 50]
lst[:]→
A
lst[:]→[10,20,30,40,50]
7
Q
lst=[10, 20, 30, 40, 50]
lst[1:3]
A
lst[1:3]→[20,30]
8
Q
lst=[10, 20, 30, 40, 50]
lst[-3:-1]→
A
lst[-3:-1]→[30,40]
9
Q
lst=[10, 20, 30, 40, 50]
lst[:3]→
A
lst[:3]→[10,20,30]
10
Q
lst=[10, 20, 30, 40, 50]
lst[3:]
A
lst[3:]→[40,50]