text: """This file contains code used in "Think Stats",
  by Allen B. Downey, available from greenteapress.com
  
  Copyright 2013 Allen B. Downey
  License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
  """
  
  from __future__ import print_function, division
  
  import thinkbayes
  import thinkplot
  
  
  """This file contains a partial solution to a problem from
  MacKay, "Information Theory, Inference, and Learning Algorithms."
  
      Exercise 3.15 (page 50): A statistical statement appeared in
      "The Guardian" on Friday January 4, 2002:
  
          When spun on edge 250 times, a Belgian one-euro coin came
          up heads 140 times and tails 110.  'It looks very suspicious
          to me,' said Barry Blight, a statistics lecturer at the London
          School of Economics.  'If the coin weere unbiased, the chance of
          getting a result as extreme as that would be less than 7%.'
  
  MacKay asks, "But do these data give evidence that the coin is biased
  rather than fair?"
  
  """
  
  class Euro(thinkbayes.Suite):
  
      def Likelihood(self, data, hypo):
          """Computes the likelihood of the data under the hypothesis.
  
          hypo: integer value of x, the probability of heads (0-100)
          data: string 'H' or 'T'
          """
          x = hypo / 100.0
          if data == 'H':
              return x
          else:
              return 1-x
  
  
  def main():
      suite = Euro(range(0, 101))
      
      suite.Update('H')
  
      thinkplot.Pdf(suite)
      thinkplot.Show(xlabel='x',
                     ylabel='Probability',
                     legend=False)
      
  
  if __name__ == '__main__':
      main()
  