<jupyter_start><jupyter_text><jupyter_code>!pip install qiskit
from qiskit import QuantumCircuit, assemble, Aer
from qiskit.visualization import plot_histogram<jupyter_output><empty_output><jupyter_text>**Encoding The Input**<jupyter_code>##Using the Bit-Flip gate as 'NOT' gate of classical
qc = QuantumCircuit(8)

##We bit-flipped the 7th bit
qc.x(7)
!pip install pylatexenc
qc.draw()
qc.measure_all()
qc.draw(initial_state=True)
simul = Aer.get_backend('aer_simulator')
result = simul.run(qc, validate=True).result()
counts = result.get_counts()
plot_histogram(counts)<jupyter_output><empty_output><jupyter_text>The output value 1 comes from the 7th qubit, as we had applied the bit-flip gate at the 7th qubit itself, and initially the values of all qubits are zero.<jupyter_code>##Using the CNOT gate to extract the output i.e. to check wheather the bits are different or the same
qc_cnot = QuantumCircuit(2)

##the CNOT gate is applied to the 2 qubits
qc_cnot.cx(0,1)
qc_cnot.draw()<jupyter_output><empty_output><jupyter_text>Here, q_0 is the control bit, and q_1 is the target bit<jupyter_code>qc_cnot1 = QuantumCircuit(2,2)
qc_cnot1.x(0)
qc_cnot1.cx(0,1)
qc_cnot1.measure_all(1,1)
qc_cnot1.measure_all(0,0)
qc_cnot1.draw()<jupyter_output><empty_output><jupyter_text>Input (q1 q0)	Output (q1 q0)            00	00            01	11            10	10            11	01The Output is 1 1, as q0 = 1 because we had initially introduced a bit flip operaor and q1 = 0<jupyter_code><jupyter_output><empty_output>