Python: Mapping from intervals to values

import bisect
bisect.bisect_left([100,300,500,800,1000], p)

here the docs: bisect

Leave a Comment