Variations of this chapter’s code
This book doesn’t cover all the features of Qiskit’s extensive library, but it does cover enough of Qiskit to help you implement some important quantum computing algorithms. To this coverage, we have added some discussion of features that make Qiskit coding easier. Qiskit provides a dozen ways to accomplish any particular task, and this book describes two or three of them.
In the previous section, you learned one way to create and display quantum circuits. In this section, you’ll learn a few more tricks.
Drawing circuits
Consider the following code:
from qiskit import QuantumRegister, \ ClassicalRegister, QuantumCircuit qReg = QuantumRegister(2, 'q') qRegNew = QuantumRegister(2, 'qNew') cReg = ClassicalRegister(2, 'c') cRegNew = ClassicalRegister(1, 'cNew') circuit = QuantumCircuit(qReg, qRegNew, cReg, cRegNew) display(circuit.draw('latex&apos...