← Quantum Store · Guides · Lessons · Glossary · About · Türkçe

Guide · Hakan Erdoğan

Getting started with quantum programming: your first Qiskit circuit

How to start quantum programming: installing Qiskit, writing your first quantum circuit (a Bell state) and what to learn next. A step-by-step guide for Python developers.

What does a quantum program look like?

A quantum program is a quantum circuit: gates applied to qubits followed by measurements. In Python you create a circuit object, add gates in order, run the circuit many times on a simulator or a real quantum processor, and look at the counts of the measurement results.

1. Install Qiskit

Python 3.10 or newer is enough. Installing into a separate virtual environment is recommended:

python -m venv quantum
# Windows: quantum\Scripts\activate   macOS/Linux: source quantum/bin/activate
pip install qiskit

2. Your first circuit: two entangled qubits (Bell state)

The program below creates two qubits, puts the first one into superposition with a Hadamard (H) gate, entangles the second with it using a CNOT gate and measures both. The circuit is run 1000 times.

from qiskit import QuantumCircuit
from qiskit.primitives import StatevectorSampler

qc = QuantumCircuit(2)
qc.h(0)        # qubit 0: superposition
qc.cx(0, 1)    # CNOT: entangle qubit 1 with qubit 0
qc.measure_all()

result = StatevectorSampler().run([qc], shots=1000).result()
print(result[0].data.meas.get_counts())

3. Read the result

The output is a count such as {'00': 507, '11': 493}; the numbers change a little on every run. 01 and 10 never appear: the two qubits always agree. That is the signature of entanglement. Each qubit on its own looks random, yet the two are linked.

Delete the qc.h(0) line and you always get 00; replace it with qc.x(0) and you always get 11. Changing gates and predicting the result is the fastest way to build quantum intuition.

4. Next steps

Try noise: on real hardware qubits make errors. With Qiskit Aer you can add a noise model and watch the same circuit’s result degrade.

Move on to algorithms: Deutsch–Jozsa, Bernstein–Vazirani and Grover are short algorithms that show how interference gives a speed-up. After them come quantum teleportation, a small Shor example that factors 15, and optimisation with QAOA.

Real hardware: with an IBM Quantum account you can send your circuit to a real processor on the free tier. Cirq, PennyLane, TKET and Amazon Braket offer the same ideas in other ecosystems.

Every Quantum Store package ships tested example code; the package pages list installation steps and the example scripts.

Frequently asked questions

Which language is used for quantum programming?

Mostly Python. Qiskit, Cirq, PennyLane and TKET are Python libraries. There are also languages such as Microsoft’s Q# and circuit description languages such as OpenQASM.

Is Qiskit free?

Yes. Qiskit is open-source software under the Apache 2.0 licence; you can run it without limits on a simulator and on real hardware through IBM Quantum’s free tier.

How long does it take to learn quantum programming?

You can learn the basic concepts and write your first circuits in a few hours. Becoming comfortable with algorithms takes a few days of practice.

Concepts in this guide

Full quantum computing glossary →

More guides

Share: X · LinkedIn