← Lab 3

Loops — do it to every value

The core patterns
  • ▸for count in spikes: — visit every value
  • ▸Accumulate: start at 0, add inside the loop
  • ▸Modify → append to a brand-new list
Level up
  • ▸enumerate → the index and the value together
  • ▸while + break — loop until a condition
  • ▸Comprehensions: the one-line, pythonic version
Python for Biologists