from qiskit import *


qr=QuantumRegister(1)

qc=ClassicalRegister(1)

cir=QuantumCircuit(qr,qc)

cir.draw()

cir.x(qr[0])

cir.draw()


cir.measure(qr,qc)


cir.draw()

simulator=BasicAer.get_backend("qasm_simulator")

res=execute(cir,backend=simulator).result()

print(res)

from qiskit.tools.visualization import plot_histogram

plot_histogram(res.get_counts(cir))

IBMQ.save_account('7cd5664973bf6ce405272fc6fa2bd7684625b387b768de3dd459fa38dd3cdc417387fa4c306562485e0bb6ddb46fd20fcd24da495248304d90d155b52011fd6f')

IBMQ.load_account()

provider=IBMQ.get_provider('ibm-q')

qcomp=provider.get_backend('ibmq_quito')

job=execute(cir,backend=qcomp)

from qiskit.tools.monitor import job_monitor

job_monitor(job)

res=job.result()

plot_histogram(res.get_counts(cir))

from qiskit import *


from math import pi

qr=QuantumRegister(1)

cr=ClassicalRegister(1)


qc=QuantumCircuit(qr,cr)

qc.draw()


qc.u3(pi,0,0,qr[0])
qc.measure(qr,cr)

qc.draw()


simulator=BasicAer.get_backend("qasm_simulator")

job=execute(qc,backend=simulator)

from qiskit.tools.visualization import plot_histogram

plot_histogram(job.result().get_counts())

plot_histogram(job.result().get_counts(qc))

qrr=QuantumRegister(1)
crr=ClassicalRegister(1)

qcc=QuantumCircuit(qrr,crr)

qcc.x(qrr[0])

qcc.z(qrr[0])

qcc.draw()

qcc.measure(qrr,crr)

simu=BasicAer.get_backend("qasm_simulator")

result=execute(qcc,backend=simu).result()

plot_histogram(result.get_counts(qcc))

qr2=QuantumRegister(2)

cr2=ClassicalRegister(2)

qc=QuantumCircuit(qr2,cr2)

qc.h(qr2[0])

qc.cx(qr2[0],qr2[1])

qc.draw()


qc.measure(qr2,cr2)

simu=BasicAer.get_backend("qasm_simulator")

result=execute(qc,backend=simu).result()

from qiskit.tools.visualization import plot_histogram


plot_histogram(result.get_counts(qc))

IBMQ.save_account('7cd5664973bf6ce405272fc6fa2bd7684625b387b768de3dd459fa38dd3cdc417387fa4c306562485e0bb6ddb46fd20fcd24da495248304d90d155b52011fd6f',overwrite=True)

IBMQ.load_account()

pr=IBMQ.get_provider('ibm-q')

qcomp=pr.get_backend("ibmq_quito")

job=execute(qc,backend=qcomp)

from qiskit.tools.monitor import job_monitor


job_monitor(job)

res=job.result()

plot_histogram(res.get_counts(qc))

qiskit.tools

from qiskit import *


from qiskit.tools.monitor import job_monitor
from qiskit.visualization import plot_histogram

qr=QuantumRegister(2)

cr=ClassicalRegister(2)


qc=QuantumCircuit(qr,cr)

qc.x(qr[0])

qc.draw()

qc.h(qr[0])

qc.cx(qr[0],qr[1])

qc.draw()

qc.measure(qr,cr)

simu=BasicAer.get_backend("qasm_simulator")

result=execute(qc,backend=simu).result()

plot_histogram(result.get_counts(qc))

IBMQ.save_account('c10fa12997ad898683c72c5496c720b9657d7b96ce93b3f443366854e87973466f32f0bd9d807b4c147a63ac230eb03987972bdf400193154e11bdd834503a58',overwrite=True)

IBMQ.load_account()

pr=IBMQ.get_provider("ibm-q")

qcomp=pr.get_backend("ibmq_manila")



job=execute(qc,backend=qcomp)

job_monitor(job)

result=job.result()


plot_histogram(result.get_counts(qc))

qr1=QuantumRegister(2)
cr1=ClassicalRegister(2)

qc1=QuantumCircuit(qr1,cr1)

qc1.h(qr1[0])

qc1.x(qr1[1])

qc1.cx(qr1[0],qr1[1])

qc1.measure(qr1,cr1)

simu=BasicAer.get_backend("qasm_simulator")

job=execute(qc1,backend=simu).result()

print(job.get_counts())

plot_histogram(job.get_counts(qc1))

qcomp1=pr.get_backend("ibmq_manila")


job1=execute(qc1,backend=qcomp1)

job_monitor(job1)

plot_histogram(job1.result().get_counts(q))

print(job1.result().get_counts())

from qiskit import *
from qiskit.visualization import plot_histogram
from qiskit.tools.monitor import job_monitor

qr2=QuantumRegister(2)

cr2=ClassicalRegister(2)


qc2=QuantumCircuit(qr2,cr2)

qc2.x(qr2[0])

qc2.x(qr2[1])

qc2.h(qr2[0])

qc2.cx(qr2[0],qr2[1])

qc2.draw()

simu=BasicAer.get_backend("qasm_simulator")

qc2.measure(qr2,cr2)

job3=execute(qc2,backend=simu)

print(job3.result().get_counts())

plot_histogram(job3.result().get_counts())

IBMQ.load_account()

pr=IBMQ.get_provider("ibm-q")

qcomp2=pr.get_backend("ibmq_manila")

job4=execute(qc2,backend=qcomp2)

job_monitor(job4)

print(job4.result().get_counts())

plot_histogram(job4.result().get_counts())

from qiskit import *

bell=QuantumCircuit(2,2)

bell.h(0)

bell.cx(0,1)

meas=QuantumCircuit(2,2)

meas.measure([0,1],[0,1])

backend=BasicAer.get_backend('qasm_simulator')

circ=bell.compose(meas)

result=backend.run(transpile(circ,backend)).result()

count=result.get_counts(circ)

print(count)


from qiskit.visualization import plot_bloch_multivector,plot_state_qsphere,plot_histogram,plot_bloch_vector

# bell=QuantumCircuit(1,1)

bell.h(0)


bell.y(0)

backend=BasicAer.get_backend('statevector_simulator')

result=backend.run(transpile(bell,backend)).result()

ps1=result.get_statevector(bell)

plot_bloch_multivector(ps1)

!pip install seaborn

# plot_state_qsphere(ps1)

# plot_bloch_vector(['00','11'])

q=QuantumCircuit(1,1)

q.y(0)

plot_bloch_multivector(q)

from qiskit_textbook.widgets import bloch_calc

!pip install qiskit_textbook

from qiskit_textbook.widgets import binary_widget
binary_widget(nbits=5)


print("Just adding for update automatically on github repo using shell script cronjob")

print("Added Second Line to Check Automatic Update")

print("third")

print($$$)

print(000)


print("Last")

print("Automatic Updates Successfully")

from qiskit import *

import numpy as np

pi=np.pi

def qft(no_of_qbit):
    qc=QuantumCircuit(no_of_qbit)
    for qbit in range(no_of_qbit):
        qc.h(qbit)
        for other_qbit in range(qbit+1,no_of_qbit):
            qc.cu1(pi/(2**(other_qbit-qbit)),other_qbit,qbit)
    return qc

display(qft(5).draw())

display(qft(4).draw())

display(qft(3).draw())

print(90)

