code: def stats():
      '''Read a stream of floats and give summary statistics'''
      import re
      import sys
      import math
      values = []
      for line in sys.stdin:
          values.extend(map(float, re.findall(r'\d+\.?\d+', line)))
  
      mean = sum(values) / len(values)
      variance = sum((val - mean) ** 2 for val in values) / len(values)
      print '%3i items; mean: %10.5f; std-dev: %10.5f' % (
          len(values), mean, math.sqrt(variance)f stats():
      '''Read a stream of floats and give summary statistics'''
      import re
      import sys
      import math
      values = []
      for line in sys.stdin:
          values.extend(map(float, re.findall(r'\d+\.?\d+', line)))
  
      mean = sum(values) / len(values)
      variance = sum((val - mean) ** 2 for val in values) / len(values)
      print '%3i items; mean: %10.5f; std-dev: %10.5f' % (
          len(values), mean, math.sqrt(variance))
docs: Read a stream of floats and give summary statistics