import numpy as np
from qiskit import QuantumCircuit
from qiskit.providers.aer import QasmSimulator
from qiskit.visualization import plot_histogram

circuit = QuantumCircuit(2,2)

#Applies Hadamard gate to qubit 0
circuit.h(0)
#Entangles qubit 0 to 1
circuit.cx(0,1)
#When passing entire quantum and classical registers, Ith qubit
#measurement result stored in Ith classical bit
circuit.measure([0,1],[0,1])

circuit.draw()

import numpy as np
from qiskit import QuantumCircuit, transpile
from qiskit.providers.basicaer import QasmSimulatorPy

simulator = QasmSimulator()
compiled_circuit = transpile(circuit,simulator)
job = simulator.run(compiled_circuit,shots=1000)
result = job.result()
counts = result.get_counts(circuit)
print("\nTotal count for 00 and 11 are:",counts)

plot_histogram(counts)