Skip to content

Instantly share code, notes, and snippets.

@quantumjim
Created September 6, 2018 09:04
Show Gist options
  • Save quantumjim/ec483daa64733412531ebf10b3b42ba3 to your computer and use it in GitHub Desktop.
Save quantumjim/ec483daa64733412531ebf10b3b42ba3 to your computer and use it in GitHub Desktop.
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, execute
shots = 1024
n = 10
batch = []
for run in range(n):
qr = QuantumRegister(1)
cr = ClassicalRegister(1)
qc = QuantumCircuit(qr, cr)
qc.h(qr[0])
qc.measure(qr,cr)
batch.append(qc)
job = execute(batch, backend='local_qasm_simulator', shots=shots)
for circuit in batch:
print( job.result().get_counts(circuit)['1']/shots )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment