from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import plot_histogram, plot_state_qsphere

# We create a quantum circuit with 2 qubits and 2 classical bits
qc1 = QuantumCircuit(2, 2)

# We apply the Hadamard gate to the first qubit
qc1.h(0)

# We apply the CNOT gate to the first and second qubits
qc1.cx(0, 1)

# We draw the circuit
qc1.draw(output='mpl')

# We execute the quantum circuit on a statevector simulator backend
backend = Aer.get_backend('statevector_simulator')
result = execute(qc1, backend).result()
statevector = result.get_statevector()

# We plot the results
plot_state_qsphere(statevector)

# We create a quantum circuit with 2 qubits and 2 classical bits
qc2 = QuantumCircuit(2, 2)

# We initialize the input state to |01>
qc2.x(0)
qc2.barrier()

# We apply the Hadamard gate to the first qubit
qc2.h(0)

# We apply the CNOT gate to the first and second qubits
qc2.cx(0, 1)
qc2.barrier()

# We draw the circuit
qc2.draw(output='mpl')

# We execute the quantum circuit on a statevector simulator backend
backend = Aer.get_backend('statevector_simulator')
result = execute(qc2, backend).result()
statevector = result.get_statevector()

# We plot the results
plot_state_qsphere(statevector)

# We create a quantum circuit with 2 qubits and 2 classical bits
qc3 = QuantumCircuit(2, 2)

# We initialize the input state to |10>
qc3.x(1)
qc3.barrier()

# We apply the Hadamard gate to the first qubit
qc3.h(0)

# We apply the CNOT gate to the first and second qubits
qc3.cx(0, 1)
qc3.barrier()

# We draw the circuit
qc3.draw(output='mpl')

# We execute the quantum circuit on a statevector simulator backend
backend = Aer.get_backend('statevector_simulator')
result = execute(qc3, backend).result()
statevector = result.get_statevector()

# We plot the results
plot_state_qsphere(statevector)

# We create a quantum circuit with 2 qubits and 2 classical bits
qc4 = QuantumCircuit(2, 2)

# We initialize the input state to |11>
qc4.x(0)
qc4.x(1)
qc4.barrier()

# We apply the Hadamard gate to the first qubit
qc4.h(0)

# We apply the CNOT gate to the first and second qubits
qc4.cx(0, 1)
qc4.barrier()

# We draw the circuit
qc4.draw(output='mpl')

# We execute the quantum circuit on a statevector simulator backend
backend = Aer.get_backend('statevector_simulator')
result = execute(qc4, backend).result()
statevector = result.get_statevector()

# We plot the results
plot_state_qsphere(statevector)