The X gate

The X gate is the quantum analogue of the classic NOT gate with respect to |"0"> and |"1">. It rotates the qubit it acts on by 180 degrees around the x axis. Let's see it in action by operating it first on |"0"> with X|"0"> and viewing the results with the plot_bloch(X*zero_qubit) statement, as follows:

Sure enough, we see that X|"0"> = |"1">. Next, we visualize X|"1"> with the plot_bloch(X*one_qubit) statement to see that X|"1"> = |"0">:

Sure enough, we can see the X gate acting as a NOT gate by flipping |"0"> to |"1"> and vice versa.