Created
January 6, 2026 13:00
-
-
Save pythonhacker/33276e498082ebd625aea0bbd6e12a2c to your computer and use it in GitHub Desktop.
IQ function using bisect module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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