python

Python Data Structures

BEGINNER

#python

Author: Alina Myronets

Course description

In this course, you will become familiar with the basic data structures of the Python programming language. We will look at how we can use Python's built-in data structures such as lists, dictionaries, tuples, and sets to accomplish various tasks.

info

Complete all chapters to get certificate

0%

Python List

chevron

What is a list? A list is a collection that is ordered and changeable. Moreover, this collection allows duplicate elements.

Creating a List

Nested List

Challenge

List Indexing

List Length

Lists Are Mutable

Append() Method

Insert() Method

Deleting Elements

Removing Elements

Python Dictionary

chevron

What is a dictionary? A dictionary is an ordered and changeable collection with no duplicate members. A dictionary holds `key:value` pairs. Key-value is provided in the dictionary to make it more optimized.

Creating a Dictionary

Challenge

Extraction of Information

Adding Items

Del Keyword

Pop() Method

Popitem() Method

Clear() Method

Python Tuple

chevron

What is a tuple? A tuple is a collection that is ordered and unchangeable. This collection allows duplicate elements. A tuple is a collection that is very similar to a list. The sequence of values stored in a tuple can be of any type, and they are indexed by integers. Values of a tuple are syntactically separated by ‘commas’. Although it is not necessary, it is more common to define a tuple by closing the sequence of values in parentheses. This helps to understand the Python tuples more easily.

Creating a Tuple

Accessing Elements of a Tuple

Concatenation of Tuples

Delete a Tuple

Update a Tuple

Adding Items

Challenge

Python Set

chevron

What is a set? In Python, a `set` is an `unordered collection` of data type that is `iterable`, `mutable` and has `no duplicate elements`. The order of elements in a set is undefined, though it may consist of various elements. The major advantage of using a set as opposed to a list is that it has a highly optimized method for checking whether a specific element is contained in the set.

Creating a Set

Add() Method

Update() Method

Accessing the Elements of a Set

Remove() and Discard() Methods

Clear() Method