Skip to content

Commit 2309431

Browse files
Quantum computing basics (#710)
* Add tutorial code for quantum computing basics tutorial * Blacken * Final QA --------- Co-authored-by: Bartosz Zaczyński <[email protected]>
1 parent 682378f commit 2309431

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

quantum-computing-basics/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Quantum Computing Basics With Qiskit
2+
3+
Code examples for the Real Python tutorial on [Quantum Computing Basics With Qiskit](https://realpython.com/quantum-computing-basics/).
4+
5+
## Requirements
6+
7+
- Python 3.10+
8+
- Dependencies from `pyproject.toml`
9+
10+
## Running the Examples
11+
12+
You can use uv to run the main example, which creates a simple quantum circuit with a Hadamard gate and measurement:
13+
14+
```sh
15+
$ uv run quantum_circuit.py
16+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[project]
2+
name = "quantum-computing-basics"
3+
version = "0.1.0"
4+
requires-python = ">=3.10"
5+
dependencies = [
6+
"qiskit[visualization]==2.2.3"
7+
]
10.3 KB
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister
2+
3+
qr = QuantumRegister(1, name="quantum")
4+
cr = ClassicalRegister(1, name="classical")
5+
qc = QuantumCircuit(qr, cr)
6+
7+
qc.h(0)
8+
qc.measure(0, 0)
9+
10+
qc.draw("mpl", filename="quantum_circuit.png")

0 commit comments

Comments
 (0)