0PricingLogin
Competitive Programming Academy · Lesson

Lists, Indexing & Slicing for CP

Access, slice, and reverse without off-by-one.

Your Contest Workhorse

In competitive Python, the list is your go-to array. It stores items in order and grows as needed, so most problems start here.

a = [4, 1, 7, 3]

Indexing from Zero

Lists use zero-based indexing, so a[0] is the first item. Forgetting this is the classic off-by-one bug that costs easy points.

a = [4, 1, 7, 3]
print(a[0])  # 4

All lessons in this course

  1. Lists, Indexing & Slicing for CP
  2. Build Arrays Fast with Comprehensions
  3. Min, Max, Sum & Running Totals
  4. Find the Index, Not Just the Value
← Back to Competitive Programming Academy