from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit,IBMQ, execute
from qiskit.visualization import *
from qiskit.tools import job_monitor


# Bell Quantum Circuit
qc=QuantumCircuit(2,2)
qc.h(0)
qc.cx(0,1)
qc.draw(output="mpl")

qc.measure([0,1],[0,1])
qc.draw(output="mpl")

#IBMQ.save_account('TOKEN ID needs to be provided')

#Load the  account
provider=IBMQ.load_account() 


provider.backends()


#Get the backend
backend=provider.get_backend('ibmq_bogota')

#Execute the circuit on the backend
job=execute(qc,backend,shots=1024)

job.status()

backend.status()

job_monitor(job)

job.status()

#Obtain the result
result=job.result()

#get and print the counts
counts=result.get_counts()
print(counts)

plot_histogram(counts,title="Bell State Counts")

job.job_id()

job.backend()

job.result()

job.status()

jobID=job.job_id()
job_get=backend.retrieve_job(jobID)

job_get

job_get.result().get_counts(qc)



counts

backend.jobs()

## 3. List of unfinished jobs of the backend: active_jobs()

backend.active_jobs()

## 4. No of jobs which can be submitted to the backend : remaining_jobs_count()

backend.remaining_jobs_count()

backend.status()

backend.name()

backend.provider()

