1/6
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 genes[0] return for genes = ['BRCA1', 'TP53', 'EGFR', 'MYC']?
'BRCA1' → indexing starts at 0
What does genes[-1] return?
'MYC' → the last item in the list
What does genes[1:3] return?
['TP53', 'EGFR'] → items at index 1 up to (not including) index 3
Why does indexing start at 0 in Python?
Index n means "n steps from the start," so the first item is 0 steps away
What does genes[:2] return?
The first 2 items (implicit start at index 0)
What does genes[2:] return?
Everything from index 2 onward (implicit end at the last item)
What's the rule for slice length?
The slice length equals end - start (e.g. genes[1:3] has 3 - 1 = 2 items)