Back to marketplace

Lists And 2D Lists

No description yet. This curated deck is ready for daily study.

Total cards: 14•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (14)

#1
Front (Question)

What is a list in Python?

Back (Answer)

A list is a data structure that can store multiple items in one variable. Example: my_list = [1, 2, 3].

#2
Front (Question)

How do you access an item in a list?

Back (Answer)

Use the index, starting from 0. Example: my_list[1] returns 2.

#3
Front (Question)

How do you change an item in a list?

Back (Answer)

Assign a new value to an index. Example: my_list[0] = 10 changes the first item to 10.

#4
Front (Question)

How do you add an item to the end of a list?

Back (Answer)

Use append(). Example: my_list.append(4) adds 4 to the end.

#5
Front (Question)

How do you insert an item at a specific position in a list?

Back (Answer)

Use insert(index, value). Example: my_list.insert(1, 99) adds 99 at index 1.

#6
Front (Question)

How do you remove an item from a list by value?

Back (Answer)

Use remove(value). Example: my_list.remove(3) removes the first 3.

#7
Front (Question)

How do you remove an item from a list by index?

Back (Answer)

Use pop(index) or del my_list[index]. Example: my_list.pop(2) removes the item at index 2.

#8
Front (Question)

How do you loop through a list in Python?

Back (Answer)

Use a for loop like for item in my_list: to access each item one at a time.

#9
Front (Question)

What is a 2D list in Python?

Back (Answer)

A list of lists. Example: matrix = [[1, 2], [3, 4], [5, 6]].

#10
Front (Question)

How do you access an item in a 2D list?

Back (Answer)

Use two indexes. Example: matrix[1][0] returns 3.

#11
Front (Question)

How do you change an item in a 2D list?

Back (Answer)

Use two indexes to assign a value. Example: matrix[2][1] = 9.

#12
Front (Question)

How do you loop through a 2D list in Python?

Back (Answer)

Use nested loops: for row in matrix: and then for item in row:.

#13
Front (Question)

What are common uses of 2D lists?

Back (Answer)

Representing data tables, grids, spreadsheets, or game boards like tic-tac-toe.

#14
Front (Question)

What is the difference between a list and a 2D list?

Back (Answer)

A list stores a single sequence of items. A 2D list stores lists within a list, forming rows and columns.