Quantum Computing Asked by Satish Kumar Dubey on October 1, 2021
I am not able to undo an operation. For example, I want a single Hadamard gate on a single qubit but by mistake two Hadamard gate added. Now I want to remove one of them without interrupting kernel. Is there any easy way. Please help me. Thank you.
To remove the last gate you can do qc.data.pop()
.
Example:
qc = QuantumCircuit(1)
qc.h(0)
qc.draw('text')
output:
┌───┐
q_0: ┤ H ├
└───┘
Then:
qc.data.pop()
qc.draw('text')
output:
q_0:
Correct answer by Frank on October 1, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP