0
$\begingroup$

I want to get the result of this code:

qreg_a = QuantumRegister (2)
qreg_b = QuantumRegister (2)
creg = ClassicalRegister (4)
qc = QuantumCircuit(qreg_a,qreg_b,creg)
qc.x(qreg_a[0])
qc.measure(qreg_a,creg[0:2])
qc.measure(qreg_b,creg[2:4])
simulator= BasicAer.get_backend('qasm_simulator')
result = execute(qc, simulator).result()
counts - result.get_counts(qc)

Quantum Lab has been discontinued. Where do I code this?

$\endgroup$

2 Answers 2

4
$\begingroup$

Google colab is one good option.

You will need to install Qiskit module(s) at the beginning, then you are ready:

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you so much for the help $\endgroup$ Commented May 20 at 8:41
5
$\begingroup$

Once you have the .qasm, you can also upload it to the Classiq platform https://platform.classiq.io/circuit, and then run it on a simulator.

To create your .qasm file (qiskit version 1.1) you will also need to have 'qiskit-qasm3-import' installed. Than use the following code:

from qiskit import *
from qiskit.providers.basic_provider import BasicProvider
import qiskit.qasm3

qreg_a = QuantumRegister (2)
qreg_b = QuantumRegister (2)
qc = QuantumCircuit(qreg_a,qreg_b)
qc.x(qreg_a[0])

with open("my_first_circuit.qasm","w") as my_file:
    qiskit.qasm3.dump(qc,my_file)

Upload the .qasm file to https://platform.classiq.io/circuit:

enter image description here

Then, press the "execute" button on the upper right hand side: enter image description here

Choose a simulator on the left hand menu: enter image description here

Press run, and you can get the histogram as well as download the results: enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.