Solution (source code)

= Solution

A $Z$ measurement is a <quantum measurement in the computational basis>. To measure $X$, apply a <Hadamard gate>, measure $Z$, and apply another <Hadamard gate> to the measured qubit. Since $HXH=Z$, this gives the $X$ outcome and leaves the qubit in the corresponding $X$ <eigenstate>.