Last active
October 6, 2022 11:50
-
-
Save frankzickert/fbde8b37e90d3c7a9450e59764895f21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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