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 this print if expression = 4.2 and threshold = 2.0?if expression > threshold:
print('Gene is upregulated')
else:
print('Gene expression is normal')
"Gene is upregulated" (4.2 > 2.0 is True)
Why use if/else instead of two separate if statements checking opposite conditions?
if/else guarantees exactly one branch runs, making the "exactly one of these happens" relationship explicit and safe from accidental edits later
In an if/elif/elif/else chain, which condition wins if multiple are true?
The first one that's true, checked top to bottom → the rest are skipped even if they'd also be true
Why does condition order matter in an elif chain (e.g. checking > 5 before > 2)?
If a broader condition (> 2) came first, it would catch values that should have matched a more specific condition (> 5), so the more specific condition never gets reached — put the most specific condition first.
What do and, or, and not do in a conditional?
and requires both sides true; or requires at least one side true; not flips true to false or false to true.
How does pandas' condition-combining syntax differ from plain Python's and/or?
pandas uses & and | instead of and/or when combining conditions across whole DataFrame columns.