Skip to content
dreamcode
dreamcode
Lesson
Practice · Binary search
  1. Predict
  2. Arrange
  3. Fill in
+20 XP on finish
PREDICT · READ BEFORE YOU WRITE

What does this program print?

Trace the program the way the computer would, then make your call before running anything.

items = [1, 3, 5, 7, 9, 11, 13]
low, high = 0, len(items) - 1
mid = (low + high) // 2
print(mid, items[mid])