Hi, I’m not sure if I’m understanding this correctly. It says in the codebook that a phase flip or Z flip is an RZ rotation where the angle is pi. The question says to use the RZ function to do the same thing as the phase flip. I can’t import the math module, so how do I code this if there is no pi?
dev = qml.device(“default.qubit”, wires=1)
@qml.qnode(dev)
def fake_z():
“”"Use RZ to produce the same action as Pauli Z on the |+> state.
Returns:
array[complex]: The state of the qubit after the operations.
"""
##################
# YOUR CODE HERE #
##################
# CREATE THE |+> STATE
qml.Hadamard(wires=0)
# APPLY RZ
phi=pi
qml.RZ(phi,wires=0)
# RETURN THE STATE
return qml.state()