class Array:

  def __init__(self,array):
    self.array=array
    self.len=len(array)

  def __getitem__(self,item):
    return self.array[item]

  def __setitem__(self, idx, value):
    self.data[idx] = value

  def __add__ (self,array_b):
    if self.len==array_b.len:
      return Array([self.array[i]+array_b[i] for i in range(self.len)])
    else:
      raise ValueError('Arrays must have the same dimension!')

  def __sub__ (self,array_b):
    if self.len==array_b.len:
      return Array([self.array[i]-array_b[i] for i in range(self.len)])
    else:
      raise ValueError('Arrays must have the same dimension!')

  def __mul__ (self,array_b):
    if self.len==array_b.len:
      return Array([self.array[i]*array_b[i] for i in range(self.len)])
    else:
      raise ValueError('Arrays must have the same dimension!')

  def __div__ (self,array_b):
    if self.len==array_b.len:
      return Array([self.array[i]/array_b[i] for i in range(self.len)])
    else:
      raise ValueError('Arrays must have the same dimension!')

  def __str__ (self):
    return '['+','.join(str(e) for e in self.array)+']'

  def __repr__(self):
    return self.array

a=Array([1,2,3,4])
b=Array([1,2,3,4])

c=a+b
d=c+c

print d/c

e=Array([1,2,3])

print e/c
