Slicing Lists
Geneticists describe C. elegans phenotypes (nematodes, a type of microscopic worms) using three-letter short-form markers. Examples include Emb (embryonic lethality), Him (high incidence of males), Unc (uncoordinated), Dpy (dumpy: short and fat), Sma (small), and Lon (long). We can keep a list:
| >>> celegans_phenotypes = ['Emb', 'Him', 'Unc', 'Lon', 'Dpy', 'Sma'] |
| >>> celegans_phenotypes |
| ['Emb', 'Him', 'Unc', 'Lon', 'Dpy', 'Sma'] |
It turns out that Dpy worms and Sma worms are difficult to distinguish from each other, so they aren’t as easily differentiated in complex strains. We can produce a new list based on celegans_phenotypes but without Dpy or Sma by taking a slice of ...
Get Practical Programming, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.