Quick actions

cmd+k|ctrl+k

Navigation

Languages

ex

Snippet info

Language

Python

Visibility

public

Author

kar-cheong

Created

2025-08-15T13:19:30.825982Z

Updated

2025-08-22T11:04:39.308692Z

#1
lst = [0, 1, 2, 3, 4, 5,]
print(lst[1:4]) # what is output ?
#2
lst = [0, 1, 2, 3, 4, 5,]
print(lst[:3])  # output?
#3
lst =  ["a","b","c","d"]
print(lst[2:])  # output?
#4
lst = [10,20,30,40,50]
print(lst[:-2])  # output?
#5
lst = ["apple","banana","cherry","date"]
print(lst[-2:])  # output?
#6
lst = [0, 1, 2, 3, 4, 5]
print(lst[::-2])  # output?
#7
lst = ('p', "y", "t", "h", "o", "n")
print(lst[::-1])  # output?
#8
lst = [0, 1, 2, 3, 4, 5]
print(lst[4:1:-1])  # output?
#9
lst = [0, 1, 2, 3, 4, 5]
print(lst[-2:5:-1])  # output?
#10
lst = [10, 20, 30, 40]
print(lst[::-2])  # output?
#11
lst = [0, 1, 2]
print(lst[5:])  # output?
#12
lst = ["a", "b", "c", "d"]
print(lst[3:1])  # output?
#13
lst = [0, 1, 2, 3, 4]
print(lst[3:0:-1])  # output?
#14
s = "hello"
print(s[::-1]) # output?
#15
lst = [0, 1, 2, 3, 4, 5, 6]
print(lst[::3])  # output?
#16
lst = [0, 1, 2, 3, 4]
print(lst[-3:4])  # output?
#17
lst = [0, 1, 2, 3, 4, 5]
print(lst[5:1:-2])  # output?
#18
lst = ["x", "y", "z"]
print(lst[2:2])  # output?
#19
s = "abcdef"
print(s[1:5:2])  # output?
#20
lst = [0, 1, 2, 3, 4, 5, 6]
print(lst[-2:1:-3])  # output?
INFO