Skip to content

Instantly share code, notes, and snippets.

@pythonhacker
Created January 6, 2026 13:00
Show Gist options
  • Select an option

  • Save pythonhacker/33276e498082ebd625aea0bbd6e12a2c to your computer and use it in GitHub Desktop.

Select an option

Save pythonhacker/33276e498082ebd625aea0bbd6e12a2c to your computer and use it in GitHub Desktop.
IQ function using bisect module
def IQ(score):
ranges = (70, 85, 115, 130, 145, 160, 180)
rating = ("intellectually disabled",
"below average",
"average",
"bright",
"gifted",
"highly gifted",
"exceptionally gifted",
"profoundly gifted/genius")
idx = bisect.bisect_right(ranges, score)
return rating[idx]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment