What is list slicing? Explain with example
Answers
Answer:
It's possible to "slice" a list in Python. This will return a specific segment of a given list. For example, the command myList[2] will return the 3rd item in your list (remember that Python begins counting with the number 0). ... Ex: myList[2:5] will return the 3rd through 5th items in your list.
List slicing refers to accessing a specific portion or a subset of the list for some operation while the orginal list remains unaffected. The slicing operator in python can take 3 parameters out of which 2 are optional depending on the requirement.
Answer:
It's possible to "slice" a list in Python. This will return a specific segment of a given list. For example, the command myList[2] will return the 3rd item in your list (remember that Python begins counting with the number 0). ... Ex: myList[2:5] will return the 3rd through 5th items in your list.
Explanation:
i hope this helps you
please mark me as a brilliant it's my humble request to you please