1/5
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What does return do that print does not?
return hands the value back to the caller so it can be stored in a variable and used further; print only displays it on screen
What would result be if normalize_expression() only used print(cpm) instead of return cpm?
None → the function wouldn't hand back a usable value.
What is a docstring (e.g. """Normalize counts per million""")?
Documentation inside a function that tools (and future-you) can pull up automatically → more than just a comment
What does def filter_genes(gene_list, min_length=4): mean by min_length=4?
min_length is a default argument → callers can omit it and get 4 automatically, or override it (e.g. filter_genes(genes, min_length=6))
Why are default arguments useful?
They make a function flexible without forcing every caller to specify every argument every time
What's the "start empty, build up by appending what passes a test" pattern, as seen in filter_genes?
Start with an empty list, loop through items, and only append() the ones that pass a condition → a very common building block in data processing.