from qiskit import IBMQ 
IBMQ.save_account('seu token')

from qiskit import *

qr = QuantumRegister(2)

cr = ClassicalRegister(2)

circuit = QuantumCircuit(qr, cr)

%matplotlib inline
circuit.draw()

circuit.h(0)
circuit.draw(output='mpl')

circuit.cx(0,1) # order is: control(0) and target(1)

circuit.draw(output='mpl')

circuit.measure(qr, cr)

circuit.draw(output='mpl')

simulator = Aer.get_backend('qasm_simulator')

result = execute(circuit, backend=simulator).result()

from qiskit.visualization import plot_histogram

plot_histogram(result.get_counts(circuit)) 

IBMQ.load_account()

provider = IBMQ.get_provider('ibm-q')

qcomp = provider.get_backend('ibmq_16_melbourne')

job = execute(circuit, backend=qcomp)

from qiskit.tools.monitor import job_monitor
job_monitor(job)