Skip to content

Instantly share code, notes, and snippets.

@armanbilge
Last active December 20, 2015 22:49
Show Gist options
  • Save armanbilge/6207768 to your computer and use it in GitHub Desktop.
Save armanbilge/6207768 to your computer and use it in GitHub Desktop.
College diversity index calculator
#!/usr/bin/env python
# Usage: diversity_index.py [percentage1 [percentage2 [...]]]
import sys
total = 0
for i in sys.argv[1:]:
total += float(i) ** 2
print 1 - total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment