Module 1 – Indexing & Slicing
Module 2 – append() & Lists
Module 3 – sort() & Mixed
Module 4 – Index Math
Module 5 – Loops & Bugs
EVERYTHING PLUS 500
100

nums list

6  9  12  15  18  21

nums = [6, 9, 12, 15, 18, 21] 

print(nums[-1])

What is nums[-1]?

A.15

B.21

C.18

D.9

B.21

100

colors list

"pink" "orange" "red"

colors = ["pink", "orange", "red"] colors.append("green")

If you run this code, how many elements are in colors at the end?

A.3 B.6 C.4 D.5 E.2


C.4

100

nums list

3537

nums = [3, 5, 3, 7] other = nums other.sort() print(nums)

What does this code print?

A.[3, 3, 5, 7]

B.It gives an error

C.[3, 5, 3, 7]

D.[7, 3, 5, 3]


A.[3, 3, 5, 7]

100

nums list

2 5 8 11 14 17

nums = [2, 5, 8, 11, 14, 17] 

a = 0 

b = 1 

index = a + b 

print(nums[index])

What number does this code print?

A.7

B.3

C.5

D.6


C.5

100

numbers = [1, 2, 3, 4]

for i in range(1, len(numbers)):    

print(numbers[i])

Rewrite this loop so it prints every value in numbers, including the first one.


numbers = [1, 2, 3, 4]

for i in range(len(numbers)):

    print(numbers[i])

Start range at 0 with range(len(numbers)) so every index is printed.

200

nums list

12  14  4  10  8  6

nums = [12, 14, 4, 10, 8, 6] nums.sort() print(nums[1])

After sorting, what is nums[1]?

A.8

B.10

C.6

D.4


C.6

200

colors list

"white""orange""red"

colors = ["white", "orange", "red"] colors.append("green")

If you run this code, how many elements are in colors at the end?

A.5

B.2

C.3

D.6

E.4

E.4

200

names list

"Sam" "Alex" "Jordan" "Bella"

names = ["Sam", "Alex", "Jordan", "Bella"] names.sort() print(names[1])

After sorting, what does this code print?

A."Sam"

B."Jordan"

C."Bella"

D."Alex"

C."Bella"

200

nums list

3 7 11 15 19 23

nums = [3, 7, 11, 15, 19, 23] 

a = 0 

b = 4

index = a + b 

print(nums[index])

What number does this code print?

A.21

B.17

C.20

D.19


D.19

200

x = 3 

if x = 3:    

print("Three")

This if-statement has a bug. Rewrite it so it runs correctly and prints "Three" when x is 3.


Use == for comparison in the if condition instead of = 

x = 3

if x == 3:

    print("Three")

300

nums list

6  15  21  9  18  12

nums = [6, 15, 21, 9, 18, 12] nums.sort() print(nums[0])

After sorting, what is nums[0]?

A.6

B.9

C.18

D.21

A.6

300

colors list

"green""orange""blue"

colors = ["green", "orange", "blue"] colors.append("cyan") colors.append("red") print(colors)

What does this code print?

A.["green", "orange", "blue"]

B.["green", "orange", "blue", "cyan", "red"]

C.["green", "orange", "blue", "red", "cyan"]

D.["cyan", "red", "green", "orange", "blue"]

B.["green", "orange", "blue", "cyan", "red"]

300

scores list

35 16 20 40

scores = [35, 16, 20, 40] scores.sort() print(scores)

What does this code print?

A.[40, 35, 20, 16]

B.[35, 20, 16, 40]

C.[16, 20, 35, 40]

D.[35, 16, 20, 40]

C.[16, 20, 35, 40]

300

nums list

4 7 10 13 16 19

nums = [4, 7, 10, 13, 16, 19] a = len(nums) b = 2 index = a - b print(nums[index])

What number does this code print?

A.16

B.18

C.17

D.14

A.16

300

for i in range(5)    

print(i)

This loop has a bug. Rewrite the whole loop so it runs correctly and prints 0 through 4.


You need a colon after range(5) and print(i) indented inside the loop.

for i in range(5):

    print(i)

 

400

pets list

"lion""fish""turtle""zebra""cat""snake""hamster""human"

pets = ["lion", "fish", "turtle", "zebra", "cat", "snake", "hamster", "human"] 

print(pets[::2])

What does this code print?

A.["lion", "turtle", "cat", "hamster"]

B.["fish", "zebra", "snake", "human"]

C.["lion", "zebra", "hamster"]

D.["lion", "fish", "turtle", "zebra"]


A.["lion", "turtle", "cat", "hamster"]

400

colors list

"red""pink""orange"

colors = ["red", "pink", "orange"] # About append()

Which statement about append() is true?

A.append() creates a brand-new list and leaves the original unchanged. 

B.append() adds a new item to the end of the existing list and changes that list.

C.append() adds a new item to the front of the list.

D.append() only works on lists of numbers.


B.append() adds a new item to the end of the existing list and changes that list.

400

names list

"Sam" "Alex" "Jordan" "Bella"

names = ["Sam", "Alex", "Jordan", "Bella"] names.sort() 

print(names[-1])

After sorting, what does this code print?

A."Jordan"

B."Alex"

C."Sam"

D."Bella"

C."Sam"

400

nums list

8 10 12 14 16 18

nums = [8, 10, 12, 14, 16, 18] a = 0 b = 3 index = a + b 

print(nums[index])

What number does this code print?

14

400

count = 0 

while count < 3    

    print(count)    

    count = count + 1

Fix this while-loop so it runs without errors and prints 0, 1, 2.

Add the colon after while count < 3 and keep the body indented.

count = 0

while count < 3:

    print(count)

    count = count + 1

500

pets list

"turtle" "ape" "dog" "human" "lion" "tiger" "zebra" "snake"

pets = ["turtle", "ape", "dog", "human", "lion", "tiger", "zebra", "snake"] print(pets[::2])

What does this code print?

A.["turtle", "human", "zebra"]

B.["turtle", "dog", "lion", "zebra"]

C.["ape", "human", "tiger", "snake"]

D.["turtle", "ape", "dog", "human"]

B.["turtle", "dog", "lion", "zebra"]

500

colors list

"yellow" "white" "orange"

colors = ["yellow", "white", "orange"] result = colors.append("yellow") print(result)

What does this code print?

A.["yellow", "white", "orange", "yellow"] B."yellow" C.None D.It causes an error

C.None

500

scores list

40 22 34 28

scores = [40, 22, 34, 28] scores.sort() print(scores)

What does this code print?

A.[40, 22, 34, 28]

B.[22, 28, 34, 40]

C.[22, 38, 28, 40]

B.[22, 28, 34, 40]

500

nums list

8 10 12 14 16 18

nums = [8, 10, 12, 14, 16, 18] a = len(nums) b = 2 index = a - b print(nums[index])

What number does this code print?

16

500

numbers = [1, 2, 3]

for n in numbers: 

print(n)

Indent this for-loop correctly so it prints every number in the list.

The print(n) line must be indented so it is inside the for-loop.

numbers = [1, 2, 3]

for n in numbers:

    print(n)

M
e
n
u