Code lab
Write real Qiskit (Python) or OpenQASM 3 and run it on a simulator inside your browser. Each exercise has tests, like Microsoft's Quantum Katas, and the tutor recognises common wrong answers and tells you what went wrong. Everything you type is saved in this browser.
Run your code to check it.
After a run I'll point out common mistakes. Stuck? Take a hint; each one reveals a bit more.
Run it on a real IBM quantum computer
The browser simulator is perfect (no noise). Real hardware isn't, and seeing the difference is worth doing once your circuit passes.
- Create a free account at IBM Quantum Platform. The Open Plan gives a monthly allowance of free hardware time (check the current terms on their site), plenty for small circuits like these.
- Install Qiskit on your laptop:
pip install qiskit qiskit-ibm-runtime. - Save your API key once (never put it in a public repo):
from qiskit_ibm_runtime import QiskitRuntimeService QiskitRuntimeService.save_account(channel="ibm_quantum_platform", token="YOUR_API_KEY") - Run your circuit:
from qiskit import QuantumCircuit from qiskit.transpiler import generate_preset_pass_manager from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() service = QiskitRuntimeService() backend = service.least_busy(operational=True, simulator=False) isa = generate_preset_pass_manager(backend=backend, optimization_level=1).run(qc) job = Sampler(mode=backend).run([isa], shots=1024) print(job.result()[0].data.meas.get_counts())
Expect a few percent of "impossible" outcomes like 01 and 10 for a Bell pair: that is gate and readout noise. API details change between Qiskit versions; if this snippet errors, check the IBM Quantum docs. Running hardware jobs straight from this website would need a small server (for example a Cloudflare Worker) to keep your API key secret; it's a possible later addition.