# Error message for codercise F.2.2

**URL:** <https://discuss.pennylane.ai/t/error-message-for-codercise-f-2-2/8003>\
**Category:** Codebook\
**Created:** [February 12, 2025, 9:17pm UTC](https://discuss.pennylane.ai/t/error-message-for-codercise-f-2-2/8003 "2025-02-12T21:17:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin6626](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/justin6626/32/1643_2.png) [@justin6626](https://discuss.pennylane.ai/u/justin6626)\
**Post date:** [February 12, 2025, 9:17pm UTC](https://discuss.pennylane.ai/t/error-message-for-codercise-f-2-2/8003/1 "2025-02-12T21:17:30Z")

</div>

Hi all, I’m trying to solve codercise F.2.2 in the codebook. My solution looks like this:

```num_wires
dev = qml.device("default.qubit", wires=num_wires)

@qml.qnode(dev)
def two_qubit_QFT(basis_id):
    """A circuit that computes the QFT on two qubits using qml.QubitUnitary. 
    
    Args:
        basis_id (int): An integer value identifying the basis state to construct.
    
    Returns:
        array[complex]: The state of the qubits after the QFT operation.
    """
    
    # Prepare the basis state |basis_id>
    bits = [int(x) for x in np.binary_repr(basis_id, width=num_wires)]
    qml.BasisState(bits, wires=[0, 1])
    
    ##################
    # YOUR CODE HERE #
    ##################
    N = 2 ** num_wires
    omega = np.exp((2 * (0 + 1j) * np.pi) / N)
    fourier_matrix = np.zeros((2 **num_wires, 2** num_wires))
    for i in range(N):
        for j in range(N):
             fourier_matrix[i][j] = omega ** (i * j)
    fourier_matrix = fourier_matrix / np.sqrt(N)
    qml.QubitUnitary(fourier_matrix, wires=[0, 1])
    
    return qml.state()

```

When I submit the code: I get an error message that says “Error: ‘ **import** ’”. Is this an error in my code, or is there an issue with the codebook itself?

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [February 13, 2025, 6:27pm UTC](https://discuss.pennylane.ai/t/error-message-for-codercise-f-2-2/8003/2 "2025-02-13T18:27:29Z")

</div>

Hi @justin6626 ,

I can confirm that your solution is not correct.

It looks like you’re having some issues because complex numbers are being cast to real ones. This is why you’re getting an import error, because your code is trying to throw an error that is unknown to the grader.

Try to think of a different way of solving the problem. You can use Python’s `complex()` function to generate complex numbers when needed.

I hope this helps!
