Editorial
For the inner products of the quantum states ∣0⟩ and ∣1⟩, the following hold:
⎩⎨⎧⟨0∣0⟩=(10)(10)=1⟨1∣0⟩=(01)(10)=0⟨0∣1⟩=(10)(01)=0⟨1∣1⟩=(01)(01)=1
Thus, when we apply an operator A=∣1⟩⟨0∣+∣0⟩⟨1∣ to the quantum states ∣0⟩ and ∣1⟩, we get the following results:
{∣0⟩AA∣0⟩=∣1⟩⟨0∣0⟩+∣0⟩⟨1∣0⟩=∣1⟩∣1⟩AA∣1⟩=∣1⟩⟨0∣1⟩+∣0⟩⟨1∣1⟩=∣0⟩
This operation that flips ∣0⟩ and ∣1⟩ can be realized with the X gate.
Sample Code
Below is a sample program:
from qiskit import QuantumCircuit
def solve() -> QuantumCircuit:
qc = QuantumCircuit(1)
qc.x(0)
return qc