code: def two_pass_variance(data):
      n = 0
      sum1 = 0
      sum2 = 0
  
      for x in data:
          n += 1
          sum1 = sum1 + x
  
      mean = sum1 / n
  
      for x in data:
          sum2 += (x - mean) * (x - mean)
  
      variance = sum2 / (n - 1)
      return variance
  
imports: from __future__ import division
  import random
  from collections import defaultdict
  from math import log
  from whoosh.compat import xrange, iteritems
label_desc: Use image node_id 6 for calling a global function with example usage: two_pass_variance(data) and returns: variance