Lists in Python
Lists:
- Similar to arrays
- No limit on size
- Contain any type of variables
- Methods in list:
- append(x): to insert an element into list
- extent(L): to append another list to the given list
- insert(i,x): to insert an element at a given position in the list
- remove(x): remove the first occurrence of the element x
- pop(i): remove the element at index position i
- index(x):return the index of first occurrence of the element x
- count(x): returns the number of times the element x appears in the list
- sort()
- reverse()
- To initialise the list with a given value
- To create a list of given range
Useful Resources :
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment