add average script
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 20 May 2010 17:10:07 +0000 (13:10 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 20 May 2010 17:10:07 +0000 (13:10 -0400)
tests/benchmark/average [new file with mode: 0755]

diff --git a/tests/benchmark/average b/tests/benchmark/average
new file mode 100755 (executable)
index 0000000..bda898c
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+import sys
+
+def main():
+       total = 0.0
+       n = 0.0
+       while 1:
+               line = sys.stdin.readline()
+               if not line:
+                       break
+
+               val = float(line)
+               n = n+1.0
+               total = total+val
+
+       print total/n
+main()
This page took 0.027057 seconds and 4 git commands to generate.