import qiskit
from qiskit import *
print(qiskit.__version__)

%matplotlib inline
from qiskit.tools.visualization import plot_histogram

from ibm_quantum_widgets import draw_circuit

circuit = QuantumCircuit(2,2)
circuit

circuit.draw(output='mpl')

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

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

circuit.cx(0,1)
circuit.draw(output='mpl')

circuit.measure([0,1],[1,1])
circuit.draw(output='mpl')

draw_circuit(circuit)

simulator = Aer.get_backend('qasm_simulator')
simulator

job = execute(circuit, backend=simulator, shots=1024)
job

result = job.result()
result

counts = result.get_counts()
counts

plot_histogram(counts)

