Codercise I.11.3 - bug?

Hi, I provided the following solution which is not accepted

def create_one_minus():
    #qml.MottonenStatePreparation(state_vector=np.array([0,0,1,-1])/np.sqrt(2), wires=range(2))
    qml.PauliX(0)
    qml.Hadamard(1)
    qml.PauliZ(1)
    return qml.expval(qml.PauliZ(0) @ qml.PauliX(1))

I cannot use qml.MottonenStatePreparation either, but that may be intended. This solution

def create_one_minus():
    qml.PauliX(0)
    qml.PauliX(1)
    qml.Hadamard(1)
    return qml.expval(qml.PauliZ(0) @ qml.PauliX(1))

works however, but all of them yield the same state. Is that expected, or is it a bug?

Hey @Vincent_Michaud-Riou!

Our evaluation script behind the scenes is checking for these operations:

        true_circuit_ops = [
            ["PauliX", "Hadamard", "PauliX"],
            ["PauliX", "PauliX", "Hadamard"]
        ]

That’s why your first code block would fail :slight_smile:. Let me see if we should fix that!

Hello @Vincent_Michaud-Riou!

Thank you for reporting this. Indeed, the tests for this codercise fail in this case. We should fix them! :wrench: We’ll get on it :running_man: !

Cheers,

Alvaro