from qiskit import QuantumCircuit from qiskit.circuit import QuantumRegister, ClassicalRegister, AncillaRegister import math def bell(x, y, circ): circ.h(x) circ.cx(x,y) return circ def bellInv(x, y, circ): circ.cx(x,y) circ.h(x) return circ def tele(): qs = QuantumRegister(3) cs = ClassicalRegister(2) circ = QuantumCircuit(qs, cs) a, b, c = qs[0], qs[1], qs[2] circ = bell(b, c, circ) circ = bellInv(a, b, circ) circ.measure(a, cs[0]) circ.measure(b, cs[1]) circ.x(c).c_if(cs[0],1) circ.z(c).c_if(cs[1],1) return circ print(tele())