Skip to content

Instantly share code, notes, and snippets.

@pythonhacker
Created January 6, 2026 12:55
Show Gist options
  • Select an option

  • Save pythonhacker/90cd86704df149f0493fd71462cb2b79 to your computer and use it in GitHub Desktop.

Select an option

Save pythonhacker/90cd86704df149f0493fd71462cb2b79 to your computer and use it in GitHub Desktop.
An IQ function written from first principles
def IQ(score):
""" IQ score -> rating """
if score < 70:
return "intellectually disabled"
elif score in range(70, 85):
return "below average"
elif score in range(85, 115):
return "average"
elif score in range(115, 130):
return "bright"
elif score in range(130, 145):
return "gifted"
elif score in range(145, 160):
return "highly gifted"
elif score in range(160, 180):
return "exceptionally gifted"
elif score > 180:
return "profoundly gifted/genius"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment