# import all necessary objects and methods for quantum circuits
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, Aer
from qiskit.tools.visualization import matplotlib_circuit_drawer as drawer

# define a quantum register with one qubit
qreg1 =  QuantumRegister(1)

# define a classical register with one bit
# it stores the measurement result of the quantum part
creg1 = ClassicalRegister(1)

# define our quantum circuit
mycircuit1 = QuantumCircuit(qreg1,creg1)

# apply h-gate (Hadamard: quantum coin-flipping) to the first qubit
mycircuit1.h(qreg1[0])

# measure the first qubit, and store the result in the first classical bit
mycircuit1.measure(qreg1,creg1)

print("Everything looks fine, let's continue ...")

# draw the circuit

drawer(mycircuit1)
# reexecute me if you DO NOT see the circuit diagram

# execute the circuit 10000 times in the local simulator

job = execute(mycircuit1,Aer.get_backend('qasm_simulator'),shots=10000)
counts1 = job.result().get_counts(mycircuit1)
print(counts1) # print the outcomes

# import all necessary objects and methods for quantum circuits
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, Aer
from qiskit.tools.visualization import matplotlib_circuit_drawer as drawer

# define a quantum register with one qubit
qreg2 =  QuantumRegister(1)

# define a classical register with one bit
# it stores the measurement result of the quantum part
creg2 = ClassicalRegister(1)

# define our quantum circuit
mycircuit2 = QuantumCircuit(qreg2,creg2)

# apply h-gate (Hadamard: quantum coin-flipping) to the first qubit
mycircuit2.h(qreg2[0])

# apply h-gate (Hadamard: quantum coin-flipping) to the first qubit once more
mycircuit2.h(qreg2[0])

# measure the first qubit, and store the result in the first classical bit
mycircuit2.measure(qreg2,creg2)

print("Everyhing looks fine, let's continue ...")

# draw the circuit

drawer(mycircuit2)
# reexecute me if you DO NOT see the circuit diagram

# execute the circuit 10000 times in the local simulator

job = execute(mycircuit2,Aer.get_backend('qasm_simulator'),shots=10000)
counts2 = job.result().get_counts(mycircuit2)
print(counts2)

# import all necessary objects and methods for quantum circuits
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, Aer
from qiskit.tools.visualization import matplotlib_circuit_drawer as drawer

#
# your code is here
#
