Python DSALesson 93Free preview
Lists and Arrays
This lesson is part of Python · All levels
Summary
This lesson discusses lists as the most basic and most commonly used data structures in Python, including comparisons to array concepts. You'll learn how to create a list, access elements with an index, cut data with slicing, and use built-in methods like append, and remove. The list is dynamic, meaning that it can increase or decrease in size as the program runs.
Key points
- The index list starts from 0 and can be given a negative number to count from the back.
- Slicing list is written in [start:end:step] format and is half-open, meaning the end limit is not taken.
- Method append() adds an element at the end, insert() insert in a certain position, and pop() takes and removes the element.
- The array modules provide a more memory-efficient, uniform data-type array than a mixed list.
- Python list is a dynamic array, as opposed to a static array in C.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.