wesm / pydata-book

Materials and IPython notebooks for "Python for Data Analysis" by Wes McKinney, published by O'Reilly Media

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In chapter 3, Binary Search and maintaining a sorted list code is not given on github

AnCyNitinChaudhary opened this issue · comments

Please Update below given code:

import bisect
c=[1,2,2,2,3,4,7]
position=bisect.bisect(c,2)
position#this will give the position of last occurence of 2
position5=bisect.bisect(c,5)#if element is not present then this will return after which position the element must be present
position5

Output:
4
6

The bisect example has been removed from the 3rd edition, so closing this