Problems with Codercise P.1.1

Hi,

I am currently trying to solve the P.1.1. Codercise but I am having trouble getting to the correct answer. If I understood correctly, the “guess_the_unitary(unitary)” function should output [1,0] or [0,1] depending on whether U is equal to Z or -Z. My circuit follows the circuit in the picture:
image
And I get the expected output according to my understanding. However, I am getting an error that says “Incorrect: the extracted state does not match the input state.” Are those the expected outputs of the function according to the input? Or did I understood wrong what we need to output? I could post the code but that would be probably giving away the answer to the Codercise. I could provide the code if it helps to determine what might be wrong.

Cheers,

Erick

Hey @erqs! Welcome to the forum :sunglasses:

If you can post your code that isn’t working that would be great :slight_smile:

1 Like

Hi Isaac,

Thanks for the quick reply, after looking into my code I found what the problem was. I was using U instead of unitary inside the function. Although the result was the correct output because U = unitary in this case, the tests were probably not recognizing it well.

Cheers,
Erick

Ah! Nice! Glad you were able to find the error :slight_smile:. If you encounter any other problems please don’t hesitate to ask!