Skip to content

Instantly share code, notes, and snippets.

@mvoitko
Created November 3, 2019 12:26
Show Gist options
  • Save mvoitko/963a6103896653dff58d64d3ea37e9a9 to your computer and use it in GitHub Desktop.
Save mvoitko/963a6103896653dff58d64d3ea37e9a9 to your computer and use it in GitHub Desktop.
import bisect
# very useful for the following kind of data:
# https://taxfoundation.org/2016-tax-brackets/
cuts = [60, 70, 80, 90]
grades = 'FDCBA'
[grades[bisect.bisect(cuts, score)] for score in [32, 64, 70, 85, 90, 99, 100]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment