old_contents: import numpy as np
  import matplotlib
  matplotlib.use('Agg')
  
  import matplotlib.pyplot as plt
  import matplotlib.mlab as mlab
  from sys import stdin
  
  
  lists = []
  currentList = []
  
  for line in stdin:
      if line.startswith("Beta: "):
          if currentList:
              lists.append(currentList)
          currentList = []
          continue
      number_str = line.strip("\n")
      if number_str:
          currentList.append(int(number_str))
  
  fig = plt.figure()
  ax = fig.add_subplot(111)
  
  # the histogram of the data
  n, bins, patches = ax.hist(lists, 10, normed=1, alpha=0.75,histtype='bar')
  
  # hist uses np.histogram under the hood to create 'n' and 'bins'.
  # np.histogram returns the bin edges, so there will be 50 probability
  # density values in n, 51 bin edges in bins and 50 patches.  To get
  # everything lined up, we'll compute the bin centers
  bincenters = 0.5*(bins[1:]+bins[:-1])
  # add a 'best fit' line for the normal PDF
  #y = mlab.normpdf( bincenters, mu, sigma)
  #l = ax.plot(bincenters, y, 'r--', linewidth=1)
  
  ax.set_xlabel('Smarts')
  ax.set_ylabel('Probability')
  #ax.set_title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
  ax.grid(True)
  
  plt.savefig("histogram.png")
  
new_contents: import numpy as np
  import matplotlib
  matplotlib.use('Agg')
  
  import matplotlib.pyplot as plt
  import matplotlib.mlab as mlab
  from sys import stdin
  
  
  lists = []
  currentList = []
  
  for line in stdin:
      if line.startswith("Beta: "):
          if currentList:
              lists.append(currentList)
          currentList = []
          continue
      number_str = line.strip("\n")
      if number_str:
          currentList.append(int(number_str))
  lists.append(currentList)
  
  fig = plt.figure()
  ax = fig.add_subplot(111)
  
  # the histogram of the data
  n, bins, patches = ax.hist(lists, 10, normed=1, alpha=0.75,histtype='bar')
  
  # hist uses np.histogram under the hood to create 'n' and 'bins'.
  # np.histogram returns the bin edges, so there will be 50 probability
  # density values in n, 51 bin edges in bins and 50 patches.  To get
  # everything lined up, we'll compute the bin centers
  bincenters = 0.5*(bins[1:]+bins[:-1])
  # add a 'best fit' line for the normal PDF
  #y = mlab.normpdf( bincenters, mu, sigma)
  #l = ax.plot(bincenters, y, 'r--', linewidth=1)
  
  ax.set_xlabel('Smarts')
  ax.set_ylabel('Probability')
  #ax.set_title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
  ax.grid(True)
  
  plt.savefig("histogram.png")
  
subject: Include the last energy level in the histogram.