from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import execute, BasicAer # Create quantum and classical registers q = QuantumRegister(2) c = ClassicalRegister(2) # Create a quantum circuit qc = QuantumCircuit(q, c) # Add gates to the circuit qc.h(q[0]) qc.cx(q[0], q[1]) # Measure the qubits and store the result in the classical register qc.measure(q, c) # Execute the circuit on a classical simulator backend backend = BasicAer.get_backend('qasm_simulator') result = execute(qc, backend).result() # Get the counts of 0 and 1s from the measurement counts = result.get_counts(qc) print(counts)In this example, we create a quantum circuit with two qubits and a classical register of two bits. We add two gates (Hadamard and CNOT) to the circuit and measure the qubits, storing the outcomes in the classical register. Finally, we execute the circuit on a simulator backend and get the counts of different measurement outcomes. The package library used in this example is Qiskit.