old_contents: # coding: utf-8
  import numpy as np
  
  
  def AND(x1, x2):
      x = np.array([x1, x2])
      w = np.array([0.5, 0.5])
      b = -0.7
      tmp = (w*x).sum() + b
      if tmp <= 0:
          return 0
      else:
          return 1
  
  if __name__ == '__main__':
      for xs in [(0, 0), (1, 0), (0, 1), (1, 1)]:
          y = AND(xs[0], xs[1])
          print(str(xs) + " -> " + str(y)) # 0を出力
new_contents: # coding: utf-8
  import numpy as np
  
  
  def AND(x1, x2):
      x = np.array([x1, x2])
      w = np.array([0.5, 0.5])
      b = -0.7
      tmp = (w*x).sum() + b
      if tmp <= 0:
          return 0
      else:
          return 1
  
  if __name__ == '__main__':
      for xs in [(0, 0), (1, 0), (0, 1), (1, 1)]:
          y = AND(xs[0], xs[1])
          print(str(xs) + " -> " + str(y))
  
subject: Update and_gate.py