I am using python 2. I don't know what is wrong with my code, wrong message is "local variable y referenced before assignment". But variable y is assigned before referenced and there is no problem for variable x. Could you help to figure it out?
  def dyn_seq(n):
        C=[0,0,1,1]
        for i in range(4,n+1):
            z=C[i-1]+1
            if i % 2==0: 
                x=C[i/2]+1
            if i % 3==0:
                y=C[i/3]+1
            minu=min(x,y,z)
            C.append(minu)
        return C
 
    