slicing stands for remove some part of values and show some of them
for slicing , you can use :n operator where n is integer positive or negative value
a:n means it shows value of a from 0 to n .
a = [1,2,3,4,5,6]
for t in a[:2]:
print(t)
a = [1,2,3,4,5,6]
a[:2] means it shows values of a from 0 to 2 , so it will print
1
2
for slicing, n: means it will slice from n to the end of the values(total length of values)
so suppose in above example , a[2:] means it will start 2 index to total length of a which is end of the list
a = [1,2,3,4,5,6]
print(a[2:])
it will print
a = [1,2,3,4,5,6]
for t in a[:2]:
print(t)
8