6 questions. Covers Half-open ranges in Python.
Questions 1 to 5 of 6
python a = [3, 1, 4, 1, 5, 9, 2, 6] total = 0 for i in range(2, 5): total += a[i] print(total, 5 - 2)
python word = "forgestack" print(word[4:7]) print(len(word[7:]))
python temps = [18, 21, 19, 25, 23] total = 0 for i in range(1, 4): total += temps[i] print(total)
range(1, 4)
total
range(3, 1, -1)
python total_items = 9 page_size = 3 for start in range(0, total_items + 1, page_size): end = min(start + page_size, total_items) print(f"page [{start}, {end}) length {end - start}")
page_size
min
max
total_items + 1
total_items
python def overlaps(a_start, a_end, b_start, b_end): return a_start <= b_end and b_start <= a_end
and
or
<=
>=
5 question(s) left on this page.