I am new to quantum computing, and I want to make a program to output 0 or 1 randomly by Hadamard gate, and use that information to make a GUI interface. For example, a coin flip program that output "Tail" when it is 1, and "Head" when it is 0. However, when I try to get raw data by job.result(job)
, I get the information of the result instead. By the way, here is the code:
from qiskit import *
simulator = Aer.get_backend('qasm_simulator')
qr = QuantumRegister(1)
cr = ClassicalRegister(1)
circuit = QuantumCircuit(qr, cr)
circuit.h(qr[0])
circuit.measure(qr, cr)
job = execute(circuit, backend = simulator, shots=1024)
a = job.result(job) #the problematic code
print(a)
I use Qiskit with Python, and do not use Jupyter notebooks.