import qiskit
from qiskit import *
print(qiskit.__version__)
%matplotlib inline
from qiskit.tools.visualization import plot_histogram

circuit = QuantumCircuit(3,3)
circuit

# qiskit.__dir__()

circuit.draw(output='mpl')

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

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

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

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

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

simulator = Aer.get_backend('qasm_simulator')
job = execute(circuit, backend=simulator,shots=1024)
result = job.result()
counts=result.get_counts()
print(counts)

plot_histogram(counts)

