#!pip install qiskit
# Include the necessary imports for this program
import numpy as np
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import execute

# Create a Quantum Register with 1 qubit (wire).
qr = QuantumRegister(1)

# Create a Classical Register with 1 bit (double wire).
cr = ClassicalRegister(1)

# Create a Quantum Circuit from the quantum and classical registers
circ = QuantumCircuit(qr, cr)

# Place an Hadamard gate on the qubit wire
circ.h(qr[0])

# Measure the qubit into the classical register
circ.measure(qr, cr)

# Draw the circuit
circ.draw(output='mpl')


# Import BasicAer
from qiskit import BasicAer

# Use BasicAer's qasm_simulator
backend_sim = BasicAer.get_backend('qasm_simulator')

# Execute the circuit on the qasm simulator, running it 100 times.
job_sim = execute(circ, backend_sim, shots=100)

# Grab the results from the job.
result_sim = job_sim.result()

# Print the counts, which are contained in a Python dictionary
counts = result_sim.get_counts(circ)
print(counts)


from qiskit.tools.visualization import plot_histogram

# Plot the results on a bar chart
plot_histogram(counts)

# Include the necessary imports for this program


# Create a Quantum Register with 1 qubit (wire).


# Create a Classical Register with 1 bit (double wire).


# Create a Quantum Circuit from the quantum and classical registers


# Place an X gate followed by a Hadamard gate on the qubit wire. The registers are zero-indexed.


# Measure the qubit into the classical register


# Draw the circuit



# Import BasicAer


# Use BasicAer's qasm_simulator


# Execute the circuit on the qasm simulator, running it 100 times.


# Grab the results from the job.


# Print the counts, which are contained in a Python dictionary


# Plot the results on a bar chart