From the course: Programming Foundations: Data Structures

Unlock the full course today

Join today to access over 25,000 courses taught by industry experts.

Built-in data structures in Python

Built-in data structures in Python - Python Tutorial

From the course: Programming Foundations: Data Structures

Built-in data structures in Python

- Each programming language comes with built-in data structures that are native to that language. Let's take a look at some of the ones that come for free with Python. We'll discuss each of these more in depth in later chapters, but this is an introduction to the different ways we can store groups of data in Python. First, we have a list. This is the most basic data structure in Python. It's used to store a collection of items in a specific order, and it's denoted by square brackets with each item separated by commas. Here we have a list containing five integers. Similar to a list is a tuple. The main difference between a tuple and a list is that a tuple is immutable, meaning it cannot be changed after it's created. A tuple is denoted with parentheses and each item is separated by commas. Here we have a tuple with two items, five and one. This structure is often used to store related data, such as a pair of coordinates. We also have dictionaries in Python. Dictionaries are used to…

Contents