I have a question regarding modifying Qiskit circuits. I have a set of circuits that are pretty similar to each other. The only difference being some gates in the beginning of each circuit. I was wondering if instead of creating new circuits each time, I could just append gates to the beginning of the circuit. However, currently, all the methods I am aware of that act on the QuantumCircuit only append to the end of the circuit.

Is there a way I can add certain gates to the beginning of a Qiskit Circuit as opposed to creating new ones each time?


1 Answer 1


Have a look at Introduction to Coding Quantum Algorithms: A Tutorial Series Using Qiskit.

In lesson 2, there is a lot of statements allow you manipulate circuits. You can add a gate on specific place, delete a gate, combine circuits etc.

The manual I refer to is very easy to understand. Each manipulation is documented with examples.

Concerning combining of the circuit, you can use this statement:

newCircuit = oldCircuit1 + oldCircuit2


newCircuit = oldCircuit2 + oldCircuit1

So, you can easily add one circuit to the end or the begin of another circuit.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.