+10 XP

List Operations

Useful things you can do with lists:

python
spikes = [10, 25, 42]

# How long is the list?
len(spikes)        # → 3

# Add a new spike time
spikes.append(67)  # spikes is now [10, 25, 42, 67]

# Slicing: get a portion
spikes[1:3]        # → [25, 42]  (items at index 1 and 2)

# Get the max and min
max(spikes)        # → 67
min(spikes)        # → 10

len(), append(), and slicing are used constantly in NMA.

Slicing [start:end] includes start but excludes end. So [1:3] gives items at index 1 and 2, not 3.