from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister

from qiskit import Aer
from qiskit import execute

from qiskit.tools.visualization import circuit_drawer, plot_histogram

qr =  QuantumRegister(2)
cr = ClassicalRegister(2)
qc = QuantumCircuit(qr, cr)

qc.measure(qr, cr)

# Draw the circuit
circuit_drawer(qc)

# Print qasm
qc_qasm = qc.qasm()
print(qc_qasm)

# Run the circuit
job = execute(qc, backend = Aer.get_backend('qasm_simulator'), shots=1024)

# get status
job.status

# get results 
result = job.result()
counts = result.get_counts()
print("Probability = ", counts['00']/1024)