my_list=[1,3,6,8,4,9,5,7,0,5,2] #list of random numbers

#oracle
def the_oracle(my_input):
    winner=7
    if my_input is winner:
        response = True
    else:
        response = False
    return response

#Searching the Oracle
for index, trial_number in enumerate(my_list):
    if the_oracle(trial_number) is True:
        print('Winner found at index %i'%index)
        print('%i calls to the Oracle used'%(index+1))
        break

from qiskit import *
import matplotlib.pyplot as plt
import numpy as np

# define the oracle ckt
oracle = QuantumCircuit(2,name='oracle')
oracle.cz(0,1)
oracle.to_gate()
oracle.draw()

backend = Aer.get_backend('statevector_simulator')
grover_circ = QuantumCircuit(2,2)
grover_circ.h([0,1])
grover_circ.append(oracle,[0,1])
grover_circ.draw()

job = execute(grover_circ, backend)
result = job.result()

sv = result.get_statevector()
np.around(sv,2)

reflection = QuantumCircuit(2,name='reflection')
reflection.h([0,1])
reflection.z([0,1])
reflection.cz(0,1)
reflection.h([0,1])
reflection.to_gate()

reflection.draw()

backend = Aer.get_backend('qasm_simulator')
grover_circ = QuantumCircuit(2,2)
grover_circ.h([0,1])
grover_circ.append(oracle, [0,1])
grover_circ.append(reflection,[0,1])
grover_circ.measure([0,1],[0,1])

grover_circ.draw()

job = execute(grover_circ, backend, shots=1)
result = job.result()
result.get_counts()