+ 1
What is slicing of data in lists ?
3 Antworten
+ 3
Slicing, as it suggests, a slice of something. In other word, a portion of something.
Real world example, a slice of a pizza.
Python list: my_list = [1, 2, 3, 4, 5]
If you want to get [2, 3] from it, you "slice" it with my_list[1:3].
print(my_list[1:3]) gives you [2, 3], "a slice of the list."
+ 2
Akash Pokhrel ,
> slicing is explained in the `python developer` tutorial in the module `working with lists`. may be you can re-read this module.
> slicing can look a bit confusing, especially when *negative slicing* or a mix of *negative and positive* slicing is used.
> it is recommended to practice this repeatedly because slicing can be very helpful. it can be applied to lists, strings, tuples,... and is also available in some other programming languages.