wesm / pydata-book

Materials and IPython notebooks for "Python for Data Analysis" by Wes McKinney, published by O'Reilly Media
Other
22.27k stars 15.19k forks source link

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

Closed AnCyNitinChaudhary closed 1 year ago

AnCyNitinChaudhary commented 1 year ago

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

wesm commented 1 year ago

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