What is Quantum Programming?
Track: Quantum Programming · Difficulty: Beginner · Est: 12 min
What is Quantum Programming?
Overview
Quantum programming is the practice of expressing a computation as a quantum circuit (or related model), then running that circuit using a workflow that mixes classical and quantum steps.
This page answers: What does it actually mean to “program” a quantum computer?
Conceptual Mapping
You already know the theory objects:
- qubits
- gates (unitaries)
- measurements
- classical outcomes and probabilities
In programming, we represent those ideas with concrete objects:
- Circuit → a list of operations applied in order
- Qubits → slots in the circuit that gates act on
- Classical bits → storage for measurement results
- Shots → repeated runs to estimate probabilities
The most important mental shift is the workflow:
- classical code builds a circuit
- a backend executes it (simulator or hardware)
- classical code collects results and decides what to do next
So the “program” is often two parts:
- a quantum circuit (what the quantum device does)
- a classical driver (how we build, run, and interpret it)
Code Walkthrough
Here is a tiny Qiskit-shaped “skeleton” to show the flow. Don’t worry about details yet.
from qiskit import QuantumCircuit
qc = QuantumCircuit(1, 1) # 1 qubit, 1 classical bit
qc.h(0) # apply a gate
qc.measure(0, 0) # measure qubit 0 into classical bit 0
print(qc)Line by line:
QuantumCircuit(1, 1)creates a circuit with one qubit and one classical bit.qc.h(0)appends a Hadamard gate to the circuit on qubit 0.qc.measure(0, 0)appends a measurement operation.print(qc)lets you see the circuit as a diagram.
Notice what is missing: nothing actually ran yet. At this stage, you are just constructing a circuit description.
What Happens Under the Hood
Conceptually, Qiskit (and similar SDKs) is doing three things:
-
Building an abstract circuit
- a structured description of qubits, gates, and measurements
-
Translating the circuit for a backend
- for simulators: map the circuit into a classical simulation procedure
- for hardware: compile into the device’s native operations and constraints
-
Executing and returning classical data
- measurements produce bitstrings
- repeating the circuit produces a distribution over bitstrings
This is exactly the bridge from theory:
- the circuit diagram you draw becomes a circuit object
- measurement probabilities become empirical frequencies via repeated shots
Turtle Tip
Think of quantum programming as “build a circuit + run it many times + interpret classical results.” The quantum computer is a specialized subroutine inside a larger classical program.
Common Pitfalls
- Expecting a quantum circuit to behave like a classical function call that returns a single deterministic value.
- Forgetting that measurement is probabilistic and requires repeated runs (shots).
- Confusing writing a circuit with running it; a circuit object is just a description until you execute it.
- Treating an SDK as the concept. Qiskit is a learning tool here; the underlying ideas are portable.
Quick Check
- What are the two parts of many quantum programs (quantum circuit vs classical driver)?
- Why do we run circuits with many shots?
- What is the difference between constructing a circuit and executing it?
What’s Next
Next you’ll set up a simple local Python environment and install Qiskit. The goal is not tooling perfection—just a clean, reproducible setup so you can focus on concepts.
