(UPI) Chapter 9: Introduction to Python Data Structures: Lists, Tuples, and Dictionaries
30-minute College Credit Course
Start Course- College Credit
- Beginner
About this Course
This course is part of our College Credit Program, designed to help you earn college credit while mastering valuable skills. If you're interested in pursuing college credit, click here to learn more.
An object is a single unit of data in a Python program. So far, this course has introduced three types of objects: strings, integers, and floats. This chapter introduces three types of containers: lists, tuples and dictionaries. A container is an object that can hold an arbitrary number of other objects. By the end of this chapter, you will be equipped to solve more complex problems using fewer variables.
List
Explore how to use lists in Python, including how to access, slice, and modify elements, work with nested lists, and check for membership.
2 stepsTuples
Tuples are immutable sequences in Python, ideal for storing fixed data. Unlike lists, their elements can't be changed after creation, offering better performance and memory efficiency.
2 stepsDictionaries
Dictionaries in Python store data as key-value pairs, where each value is accessed via its associated key. They are mutable, allowing you to change values, and offer efficient data retrieval. You can create dictionaries using key-value pairs, lists of tuples, or the zip function to pair multiple lists together.
3 steps