Setup and Your First Circuit
Qiskit is IBM's open-source Python SDK for quantum computing: build a quantum circuit in Python, run it on a simulator (or real quantum hardware), and read back the results. A classical bit is always definitely 0 or 1, a qubit can be in a mix of both at once (superposition), and two qubits can become correlated in a way with no classical equivalent (entanglement). This course builds up both ideas from scratch, in code.
Installing Qiskit
Qiskit relies on compiled numerical libraries that aren't available in this course's browser sandbox, so write and run this project locally with a real Python install.
pip install qiskit qiskit-aer
qiskit is the core library for building circuits, qiskit-aer adds the high-performance local simulator you'll use throughout this course, before ever touching real quantum hardware.
Building a circuit
from qiskit import QuantumCircuit
qc = QuantumCircuit(1, 1) # 1 qubit, 1 classical bit
qc.x(0) # flip the qubit from |0> to |1>
qc.measure(0, 0) # read the qubit into the classical bit
print(qc.draw())
QuantumCircuit(1, 1)allocates one qubit (starts in state|0>, physicists' notation for "definitely 0") and one classical bit to eventually hold a measurement result, quantum and classical bits are tracked separately.qc.x(0)applies the X gate to qubit 0, the quantum equivalent of a classical NOT: it flips|0>to|1>(and vice versa).qc.measure(0, 0)measures qubit 0 and stores the outcome in classical bit 0. Measuring is a one-way operation, before this line the qubit's state is quantum information, after it, you have an ordinary classical bit.qc.draw()renders the circuit as an ASCII diagram, useful for sanity-checking what you built before running it.
NOTE
Every code block in this course needs a real local Python + Qiskit install to run, quantum simulation depends on compiled numerical libraries this course's browser sandbox doesn't have. Treat this course like the Pygame or Kivy projects: read, understand, and run the code on your own machine.