Programming with Python

⌘K
  1. Home
  2. Docs
  3. Programming with Python
  4. List, Tuples and Dictiona...
  5. Lists
  6. List Slices

List Slices

List slicing extracts the subset of elements from a list

Syntax

listname[start:stop]
listname[start:stop:steps]
  • Default value of start is 0
  • Default value of stop is n-1
  • [:] prints the entire list
  • [a:a] prints the empty list. When start and stop is equal, then the slice is empty

Loading

Views: 0

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments