Advertisement
Guest User

Untitled

a guest
Nov 4th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import random
  4.  
  5. def candidates():
  6.     return [random.gauss(100, 15) for x in range(100)]
  7.  
  8. def average(values):
  9.     return sum(values) / len(values)
  10.  
  11. def merit(values):
  12.     return sum(values)
  13.  
  14. for x in range(10):
  15.     sexist_merit = []
  16.     equal_merit = []
  17.     pure_merit = []
  18.  
  19.     for x in range(1000):
  20.         men = candidates()
  21.         women = candidates()
  22.         people = men + women
  23.         sexist_merit.append(merit(sorted(men)[93:100] + sorted(women)[97:100]))
  24.         equal_merit.append(merit(sorted(men)[95:100] + sorted(women)[95:100]))
  25.         pure_merit.append(merit(sorted(people)[190:200]))
  26.  
  27.     print "Averages-- pure:%f, equal:%f, sexist:%f" % (average(pure_merit), average(equal_merit), average(sexist_merit))
  28.  
  29. stephenj@pastinha:~/sharing (master)$ python quotas.py
  30. Averages-- pure:1306.405407, equal:1302.856431, sexist:1296.833211
  31. Averages-- pure:1307.397649, equal:1304.207673, sexist:1298.507569
  32. Averages-- pure:1307.631590, equal:1304.235352, sexist:1298.252491
  33. Averages-- pure:1306.141478, equal:1302.768670, sexist:1297.322975
  34. Averages-- pure:1307.144755, equal:1303.818964, sexist:1297.999458
  35. Averages-- pure:1306.688380, equal:1303.364114, sexist:1297.520212
  36. Averages-- pure:1306.749686, equal:1303.590202, sexist:1298.286172
  37. Averages-- pure:1305.615128, equal:1302.247885, sexist:1296.545001
  38. Averages-- pure:1307.377004, equal:1304.206474, sexist:1298.380275
  39. Averages-- pure:1306.336245, equal:1303.085456, sexist:1297.115914
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement