Step 1 seems incorrectly checked

Step 1 seems incorrectly checked to me. I initially added the line pivot_idx = randrange(start, end + 1) into the function, realizing that without the +1 the last element would be excluded. But when I ran it I got an error asking (paraphrasing as I didn’t copy it) if I had added a call to randrange with start and end + 1)…which I had done. After triple-checking my code I finally removed the +1 and submitted with pivot_idx = randrange(start, end)…and it passed! Which is wrong because, as stated above, the +1 is necessary to choose a representative pivot. So the error message was correct but the system checking my code was looking for something incorrect, which was rather frustrating.

2 Likes