Quantum World

The latest version of this notebook is available on https://github.com/QISKit/qiskit-tutorial.


Contributors

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]:
[<IBMQBackend('ibmqx4') from IBMQ()>,
 <IBMQBackend('ibmqx5') from IBMQ()>,
 <IBMQBackend('ibmqx2') from IBMQ()>,
 <IBMQBackend('ibmq_16_melbourne') from IBMQ()>,
 <IBMQBackend('ibmq_qasm_simulator') from IBMQ()>]

In [4]:
backend = least_busy(IBMQ.backends(simulator=False))
print("The least busy backend is " + backend.name())


The least busy backend is ibmq_16_melbourne

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!')


You have made entanglement!

The circuit that was run on the machine is


In [7]:
circuit_drawer(qc)


Out[7]: