List and Its Operations

Learn what lists are and what operations can be performed on lists.

Lists

A list in Python is just an ordered collection of heterogeneous item types and is dynamically mutable, meaning its size can change. List data structures support operations like add, delete, and insert.

Press + to interact
## creating empty lists
fruits = []
## adding elements to list
fruits.append('apple')
fruits.append('banana')
fruits.append('orange')
print(fruits)

Key Pointers

  • Python List
  • Mutable
  • Heterogeneous or homogeneous items, hence can be used as arrays
  • Loosely typed
  • Built-in into Python
  • Generally comparatively slower than arrays, though the performance may vary in different use cases

Common PowerShell array and Python lists operations

Let’s discuss the common array operations.

Finding Length

...