Skip to content

Instantly share code, notes, and snippets.

@frankzickert
Last active October 6, 2022 11:50
Show Gist options
  • Save frankzickert/fbde8b37e90d3c7a9450e59764895f21 to your computer and use it in GitHub Desktop.
Save frankzickert/fbde8b37e90d3c7a9450e59764895f21 to your computer and use it in GitHub Desktop.
from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import plot_histogram
# Create a quantum circuit with one qubit
qc = QuantumCircuit(1)
# YOUR CODE GOES HERE
qc.ry(pi/2, 0)
# measure the qubit
qc.measure_all()
# Tell Qiskit how to simulate our circuit
backend = Aer.get_backend('qasm_simulator')
# Do the simulation, returning the result
result = execute(qc,backend, shots=1000).result()
# get the probability distribution
counts = result.get_counts()
# Show the histogram
plot_histogram(counts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment