← Quiz: Sorting, heapq and bisect: all 10 questions
Quiz: Sorting, heapq and bisect · Question 9 of 10
What happens if you call bisect on an unsorted list?
What happens if you call bisect on an unsorted list?
- A.It raises ValueError
- B.It sorts the list first
- C.It returns a position without error, but the answer may be wrong
- D.It falls back to a linear search
Answer & explanation
Correct answer: It returns a position without error, but the answer may be wrong
bisect assumes the list is sorted and does not check.
Can you get the rest right without peeking?
Take the timed Quiz: Sorting, heapq and bisect quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →