List Basics
List indexing
List methods
Looping through lists
list membership
100

How do you create an empty list in python?

A. my_list = []

B. my_list = ()

A
100

What does negative indexing mean in lists?

Counting from the end (e.g. -1 is last element)

100

What method adds an item to the end of a list?

.append()

100

What keyword starts a for loop in Python?

for

100

What operator checks if an item exists in a list?

in

200

What is the index of the first element in a Python list?

0

200

Given letters = ['a', 'b', 'c', 'd'], what is letters[-1]?

'd'

200

What method removes the first matching element from a list?

.remove()

200

What does this loop print? for x in [1, 2, 3]: print(x)

1, 2, 3

200

What is the output of 

'a' in ['a', 'b', 'c']?

True

300

Given nums = [10, 20, 30, 40], what does nums[2] return?

30

300

Given nums = [2, 4, 6, 8, 10], what does nums[1:4] return?

[4, 6, 8]

300

Given nums = [1, 2, 3], what is the result after nums.append(4)?

[1, 2, 3, 4]

300

How many times does this loop run? for x in [10, 20, 30, 40]: print(x)

4 times

300

What function returns the number of elements in a list?

len()

400

What happens if you try to access an index that doesn’t exist?

You get an error.

400

Given fruits = ['apple', 'banana', 'cherry', 'date'], what does fruits[:-1] return?

['apple', 'banana', 'cherry']

400

Given fruits = ['apple', 'banana', 'cherry'] and fruits.remove('banana'), what is the new list?

['apple', 'cherry']

400

What is the output? 

nums = [1, 2, 3]

total = 0

for n in nums: 

     total += n

     print(total)

6

400

Given nums = [3, 6, 9, 12], what is len(nums)?

4

500

What type of data structure is a list in Python — mutable or immutable?

Mutable

500

Given nums = [1, 2, 3, 4, 5], what does nums[::-1] do?

Reverses the list → [5, 4, 3, 2, 1]

500

How do you combine two lists, a = [1, 2] and b = [3, 4], into one list?

a + b

500

What does this code print? 

for i in range(len(['a','b','c'])): 

     print(i)

0, 1, 2

500

What is the output of 

'cat' not in ['dog', 'bird', 'fish']?

True