import math
import numpy as np

class Register:

    def __init__(self, state):
        """Initialise quantum register

        state - column vector representing initial quantum state. Example:
            [
                (0.0, 0.0i) # 00
                (0.0, 0.0i) # 01
                (1.0, 0.0i) # 10
                (0.0, 0.0i) # 11
            ]
        shows a "collapsed quantum state" because 10 is the only state set to 1

        A register can be in a measured state superposition of states e.g.
        if a Hadamard gate is applied to a 1-qubit system then the qubit
        would be in a superposition of being both 0 and 1

        The state of the register must always follow this equation:
        Let a, b and c be complex numbers representing the quantum states of a
        2-qubit system: |a|^2 + |b|^2 + |c|^2 + |d|^2 = 1
        """

        eps = 0.0001
        total = complex(0, 0)
        for s in state:
            total = total + pow(np.abs(s), 2)
        if(not (abs(total - (complex(1, 0))) < eps)):
            raise Exception("Quantum state is invalid")

        self.state = state
@@ -233,16 +233,17 @@
 .0i) # 0
+ 
 0%0A      
@@ -267,16 +267,17 @@
 .0i) # 0
+ 
 1%0A      
@@ -301,16 +301,17 @@
 .0i) # 1
+ 
 0%0A      
@@ -335,16 +335,17 @@
 .0i) # 1
+ 
 1%0A      
@@ -403,16 +403,17 @@
 ecause 1
+ 
 0 is the

format register constructor comment better