I Ran My First Quantum Circuit, and It Refused to Give Me the Same Answer Twice
The badge gave me the theory. Tonight I installed the tools, wrote ten lines of code, and ran my first real quantum circuit on my own laptop. It handed me a different answer every single time. That is not a bug. That is the entire point, and it is the moment quantum stopped being abstract for me.
In the last post I earned the IBM Fundamentals of Quantum Algorithms badge, and I said the next step was Qiskit, in code, until I understood what every gate actually does. This is that step.
Tonight I went from reading about superposition to watching my own machine produce it. I am still a self-taught automation builder with no physics degree. I just have a terminal, ten lines of Python, and a problem I cannot put down. Here is exactly what happened, including the parts that tripped me up.
Building the lab
Before you can run anything, you need the environment. The stack I installed:
- Qiskit , IBM's open-source SDK, version 2.4. This is where you build and simulate circuits.
- Qiskit Aer , the local high-performance simulator. It runs circuits on my own processor, so I can learn without spending real hardware time.
- qiskit-ibm-runtime , the client that connects my laptop to real IBM quantum processors over the cloud.
- Jupyter and VS Code , because every piece of quantum learning material lives in notebooks.
A few honest notes, because the setup is where most beginners quietly give up.
I am running Python 3.14, which is brand new. Almost everything installed cleanly, but the scientific Python ecosystem always lags a step behind the newest interpreter. If a package ever refuses to install, the fix is a separate environment built on Python 3.12, the version the whole quantum stack is actually tested against. Worth knowing before you lose an hour to it.
I also learned, the slightly embarrassing way, that you never install any of this globally. You create a virtual environment for the project, activate it, and install everything inside it. At one point I opened my editor and wandered straight into the virtual environment's internal config files, convinced they were mine to edit. They are not. Your code lives next to the environment, never inside it. That folder is the engine, not the cockpit.
None of this is quantum. It is just the discipline of a clean Python project. But it is the gate you pass before anything interesting happens.
Ten lines that bend your brain
Here is the entire program. Two qubits, three operations, then read the result.
from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator
qc = QuantumCircuit(2, 2)
qc.h(0) # superposition on qubit 0
qc.cx(0, 1) # entangle qubit 1 with qubit 0
qc.measure([0, 1], [0, 1])
result = AerSimulator().run(qc, shots=1024).result()
print(result.get_counts())
A Hadamard gate on the first qubit puts it into superposition: not 0, not 1, but a genuine 50/50 of both at once. A CNOT gate then entangles the second qubit to the first, linking their fates. Then I measure both.
That is it. This circuit has a name: a Bell state. It is the "hello world" of quantum computing, and it is the simplest possible demonstration of entanglement, the phenomenon Einstein spent years refusing to accept.
I ran it with 1024 shots, which means the circuit is executed and measured 1024 times.
The computer refused to give me the same answer twice
First run: 542 results of 11, and 482 results of 00.
I ran the exact same file again. This time, 501 of 11 and 523 of 00.
Two runs. Two different answers. Same code, same input, every time.
My classical-programmer brain flinched. In normal software, identical input producing different output is the definition of a bug. You hunt it down and kill it. Here, it is not a defect. It is the nature of the machine.
The qubit in superposition is a real coin flip, decided only at the instant of measurement. And a fair coin flipped 1024 times never lands exactly half and half. You get 542/482, then 501/523, always near the middle but almost never on it. A quantum computer does not return an answer. It returns a distribution. You read it the way you read a poll, not the way you read a calculator.
Look closely at those two runs and the point jumps out. In the first, 00 was the minority. In the second, 00 was suddenly the majority. Neither outcome is "the right answer," because there is no right answer to land on. The result genuinely reshuffles every time you ask.
But here is the part that did not change, not once, across either run: the only results that ever appeared were 00 and 11. Never 01. Never 10.
That is entanglement. The two qubits are not flipping independently. They are one linked system. If the first collapses to 0, the second is guaranteed to be 0. If the first is 1, so is the second. They were never separate to begin with. Einstein called this "spooky action at a distance," and it bothered him for the rest of his life. I produced it on a MacBook Air at two in the morning.
What this actually taught me
The badge taught me superposition and entanglement as concepts. As vectors, amplitudes, and matrices. I could define them. I could answer the questions.
Running the circuit taught me something the math on its own never did: a quantum result is probabilistic and correlated. The output is a shape, not a value. I had read that exact sentence a dozen times while studying for the badge. I did not feel it until my own laptop printed two different answers and dared me to call it broken.
That is the gap between knowing something and understanding it, and the only bridge across it is running the code. This is exactly why I am doing this in public and in code, instead of collecting certificates. A badge proves you passed. Running the circuit proves you get it.
It also makes the honest version of the hype obvious. The randomness and the correlation are not bonus features. They are the thing you have to design around. A quantum computer does not hand you one clean deterministic answer. You manage probability, and on real hardware you manage noise on top of it. That nuance is the first casualty of every breathless quantum headline.
Where I am going next
The plan from here is concrete:
Implement the badge algorithms from scratch in Qiskit, starting with Deutsch-Jozsa, then Simon's, then Grover's. Not copy them. Build them, gate by gate, until I can explain why each one is there.
Run a circuit on real IBM hardware , not just the local simulator, and watch real-world noise enter the results for the first time.
Keep pushing on the Python side, because fluency in Qiskit is, increasingly, fluency in the field itself.
The badge was the theory. Tonight was the first time the theory ran on my own machine and surprised me. That surprise is exactly why I am not going back.
If you are a developer or a builder circling quantum from a distance, this is the honest, from-scratch version of the journey, written as it happens. Subscribe below and I will send you each post as it lands. No noise, just the actual work.
The first circuit is running. Let us see what it computes next.
Discussion in the ATmosphere