Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 758 Bytes

slicing.md

File metadata and controls

18 lines (14 loc) · 758 Bytes

✍️ Notes for Slicing in Python

[start : stop : steps]

  • slicing will start from index start
  • will go up to stop in number of steps
  • Default value of start is 0, stop is last index of list and for step it is 1
  • [: stop] will slice list from starting till stop index
  • [start : ] will slice list from start index till end
  • Negative value of steps shows right to left traversal instead of left to right traversal
    • [: : -1] prints list in reverse order.

📚 Resources Used in Researching List Comprehension