Skip to content

Instantly share code, notes, and snippets.

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

  • Save pythonhacker/5ed0492377734b202ab5807608d08087 to your computer and use it in GitHub Desktop.

Select an option

Save pythonhacker/5ed0492377734b202ab5807608d08087 to your computer and use it in GitHub Desktop.
IQ function rewritten using the custom range dictionary
def IQ(score):
""" IQ function using range dictionary """
scores_class_dict={0: 'intellectually disabled',
70: 'below average',
85: 'average',
115: 'bright',
130: 'gifted',
145: 'highly gifted',
160: 'exceptionally gifted',
180: 'profoundly gifted/genius'
}
d = RangeDict(scores_class_dict)
return d[score]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment