# Getting an error running a program in IBM Q Experience Quantum lab

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
$$$$


## 1 Answer

You need to import QuantumCircuit from qiskit:

from qiskit import QuantumCircuit

I imagine you will probably also need to do:

from qiskit import execute

And you can combine your three imports neatly into one line like so:

from qiskit import Aer, QuantumCircuit, execute
`
• thanx u solved my problem. got the results – parth Sep 8 at 11:03