The latest version of this notebook is available on https://github.com/QISKit/qiskit-tutorial.
Jay Gambetta and Ismael Faro
In [1]:
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
from qiskit import execute
from qiskit import IBMQ
from qiskit.backends.ibmq import least_busy
from qiskit.wrapper.jupyter import *
# import basic plot tools
from qiskit.tools.visualization import plot_histogram, circuit_drawer
In [2]:
IBMQ.load_accounts()
In [3]:
IBMQ.backends()
Out[3]:
In [4]:
backend = least_busy(IBMQ.backends(simulator=False))
print("The least busy backend is " + backend.name())
In [5]:
%%qiskit_job_status
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)
qc.h(q[0])
qc.cx(q[0], q[1])
qc.measure(q, c)
job_exp = execute(qc, backend=backend, shots=1024, max_credits=3)
In [6]:
plot_histogram(job_exp.result().get_counts(qc))
print('You have made entanglement!')
The circuit that was run on the machine is
In [7]:
circuit_drawer(qc)
Out[7]: