+10 XP

What is a List?

A list stores many values in order, in a single variable. In neuroscience, think of it like a spike train — a sequence of spike times.

python
# A spike train: times when a neuron fired (in ms)
spike_times = [10, 25, 42, 67, 89, 103]

# A list can hold any type
neuron_ids = [0, 1, 2, 3, 4]
brain_regions = ['V1', 'V2', 'PFC', 'hippocampus']
voltages = [-70.0, -68.5, -55.0, 20.0, -70.0]

Lists use square brackets [ ] and commas between items.

Indexing — accessing items by position (starting from 0!):
`python
spike_times = [10, 25, 42, 67]
spike_times[0] → 10 # first item
spike_times[1] → 25 # second item
spike_times[-1] → 67 # last item
`

Python counts from 0, not 1! This trips up beginners. The first item is at index [0].