Deck 7: Functions

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/5

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:35 PM on 8/10/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

6 Terms

1
New cards

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

2
New cards

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.

3
New cards

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

4
New cards

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))

5
New cards

Why are default arguments useful?

They make a function flexible without forcing every caller to specify every argument every time

6
New cards

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.