from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector

# Create a quantum circuit with one qubit
qc = QuantumCircuit(1)

# Put the qubit into an uneven superposition
# ry(theta) is a rotation around the y-axis by angle theta
qc.ry(1.0, 0)

# Print the statevector |𝜓❭
print(f"The Qubit is in State |𝜓❭ = {Statevector.from_instruction(qc).data}")

# Let's apply the X gate; notice how it swaps the amplitudes of the |0❭ and |1❭ basis states
qc.x(0)

# Print the statevector X|𝜓❭
print(f"The Qubit is in State X|𝜓❭ = {Statevector.from_instruction(qc).data}")

# Applying the Z gate adds -1 relative phase to the |1❭ basis states
qc.z(0)

# Print the statevector ZX|𝜓❭
print(f"The Qubit is in State ZX|𝜓❭ = {Statevector.from_instruction(qc).data}")

# Finally, applying the Y gate returns the qubit to its original state |𝜓❭, with an extra global phase of i
qc.y(0)

# Print the statevector YZX|𝜓❭
print(f"The Qubit is in State YZX|𝜓❭ = {Statevector.from_instruction(qc).data}")

