qiskit-textbook
qiskit-textbook copied to clipboard
Chapter 1: The atoms of computation
Describe the bug
The second code exercise in "Your first quantum circuit" does not run, because the "QuantumCircuit" module is not being imported. Adding from qiskit import QuantumCircuit
to the code editor fixes the error.
To Reproduce
Run the code in the editor.
Expected behavior
The code should run and produce output demonstrating the code's functionality.
Version info
Beta Textbook
For website problems please state device / OS / browser.
MacBook Air M1 / macOS Monterrey/ Safari 15.4
Screenshots
Additional context
No response
Hey! So essentially each topic/section in a chapter say "The atoms of computation" is a Jupyter notebook and hence the code present in all the cells is run in the same(single) environment. It is stated clearly at the beginning of the Atoms of computation section that you will have to run the cell which contains all the imports(including that of QuantumCircuit) to be able to run the rest of the code in that section(image attached below). So the problem that you have encountered might probably be because you either forgot to run the import cell or you would have run it long back and the kernel would have died as a result of non-activity which is probably why the imports have not been reflected. Hope that helps and please correct me if I'm wrong :)