Consider the following quantum circuit

Complete the circuit function that represents this quantum circuit. You will need to write the gates contained in this circuit. Note that the gate depends on an angle parameter!

def circuit(): # Write any arguments you need here
"""
This quantum function implements the circuit shown above
and returns the output quantum state
"""

####################
###YOUR CODE HERE###
####################

return qml.state()


or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Identify different types of devices available in PennyLane.
  • Create a simple quantum function in PennyLane using elementary gates.
  • Turn a quantum function into a QNode and return the quantum state.
  • Draw a circuit to verify that it has been constructed properly.