Beginner Python Concepts


Data Structures

Data structures are objects, which means they are more complex variables. All objects can technically be considered data strucures, as they can hold more data than primitive variable. However, most Computer Scientists are referring to objects like Lists / Arrays, Dictionaries, Trees, Graphs, Etc when discussing data structures.

Arrays are groups of primitive variables all stored together. In Python, we refer to these as lists. Here are a couple of examples of lists:

example_list = []

example_list_2 = [1,2,3]

example_list_3 = ['a','b','c']

example_list_4 = [1, 'b', 3]

To add elements to a list, use the .append() function. To access specific items in a list, you can use an index.

Try adding, accessing, and removing elements from this list!

To sort a list, use the .sort() or sorted() functions.

Try adding, accessing, and removing elements from this list!

Dictionaries are Python's answer to Switch Statements. The logic of a dictionary is to return a value based on an input value / key. In other languages, Switch Statements are used to accomplish similar logic. Here are a couple examples of dictionaries:

alphabet_dict  = {

number_dict  = {

Dictionaries are created in a similar way to lists.

Try adding, accessing, and removing elements from this dictionary!

Lists of Lists

2D Arrays are commonly used in coding. In Python, this can be thought of as a list of lists.

Try accessing and setting different values in the list of lists!
Create your playground on
This playground was created on, our hands-on, knowledge-sharing platform for developers.
Go to