And all of result[i]'s turn out to be the same.
This is what I get from the program you posted:
[1 0 1 0 1 0 1 1 1 0]
[1 0 1 0 1 0 1 1 1 0]
[0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0]
Traceback (most recent call last):
File "test.py", line 16, in <module>
print(result[i])
KeyError: 9
The first 2 arrays are not the same as the rest, but they are correlated (that's what happens after CNOT is applied to an H).
The key error is because you are performing a run_and_measure on a 9 qubit device and you are trying to print 10 measurement arrays. Studying the docs for run_and_measure: "This will measure all the qubits on this QuantumComputer, not just qubits that are used in the program. Returns a dictionary keyed by qubit index where the corresponding value is a 1D array of measured bits."
Let's print out result
print(result)
#0: array([1, 1, 0, 1, 1, 0, 0, 0, 0, 0]), 1: array([1, 1, 0, 1, 1, 0, 0, 0, 0, 0]), 2: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 3: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 4: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 5: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 6: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 7: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 8: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])}
You can see that the 10 different results from run_and_measure of the first qubit and second are the same and the rest are 0's cause we don't apply gates to them.