Deck 4: Lists and Indexing

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/6

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:58 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

7 Terms

1
New cards

What does genes[0] return for genes = ['BRCA1', 'TP53', 'EGFR', 'MYC']?

'BRCA1' → indexing starts at 0

2
New cards

What does genes[-1] return?

'MYC' → the last item in the list

3
New cards

What does genes[1:3] return?

['TP53', 'EGFR'] → items at index 1 up to (not including) index 3

4
New cards

Why does indexing start at 0 in Python?

Index n means "n steps from the start," so the first item is 0 steps away

5
New cards

What does genes[:2] return?

The first 2 items (implicit start at index 0)

6
New cards

What does genes[2:] return?

Everything from index 2 onward (implicit end at the last item)

7
New cards

What's the rule for slice length?

The slice length equals end - start (e.g. genes[1:3] has 3 - 1 = 2 items)