Practice drawing quantum circuits. Feel free to play around with the circuit itself.

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


@qml.qnode(dev)
def circuit():
"""
Implements a circuit and returns the state
"""
qml.Hadamard(wires=0)
qml.CRY(np.pi / 4, wires=(0, 1))
qml.CRX(np.pi / 3, wires=(1, 2))
qml.S(wires=1)
qml.T(wires=2)
qml.Toffoli(wires=(0, 1, 2))
qml.SWAP(wires=(0, 2))
return qml.state()


print() # use qml.draw()

or to submit your code

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

Learning Objectives:

  • Represent quantum circuits graphically.
  • To use debugging tools on PennyLane code.