Running the program in Quantum Lab, it shows error. I am looking for solution.
Here is a code I run:
circ = QuantumCircuit(3)
circ.h(0)
circ.cx(0, 1)
circ.cx(0, 2)
circ.draw('mpl')
from qiskit import Aer
backend = Aer.get_backend('statevector_simulator')
job = execute(circ, backend)
result = job.result()
outputstate =result.get_statevector(circ, decimals=3)
print(outputstate)
An here is an error I got:
NameError Traceback (most recent call last)
<ipython-input-3-17b8e431afa9> in <module>
----> 1 circ = QuantumCircuit(3)
2 # Add a H gate on qubit 0, putting this qubit in superposition.
3 circ.h(0)
4 # Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting
5 # the qubits in a Bell state.
NameError: name 'QuantumCircuit' is not defined
```