<jupyter_start><jupyter_text>Default Imports<jupyter_code>%matplotlib inline
# Importing standard Qiskit libraries and configuring account
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
# Loading your IBM Q account(s)
provider = IBMQ.load_account()<jupyter_output>/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/ibmqfactory.py:192: UserWarning: Timestamps in IBMQ backend properties, jobs, and job results are all now in local time instead of UTC.
  warnings.warn('Timestamps in IBMQ backend properties, jobs, and job results '<jupyter_text>Circuit<jupyter_code>qbit = 5
creg = 5

circuit = QuantumCircuit(qbit,creg)
circuit.draw('mpl')
circuit.cx(0,1)
circuit.draw()
for i in range(4):
    circuit.cx(i+1,i+2)

circuit.draw()

circuit.h([0,1,4])
circuit.draw()
circuit.h(2)
circuit.h(3)
circuit.draw()
circuit.x(range(5))
circuit.draw()
circuit.measure(0,0)
circuit.measure(1,1)
circuit.draw()
circuit.measure(range(2,5),range(2,5))
#circuit.measure([2,3,4],[3,2,4])
circuit.draw()
backend_run = Aer.get_backend("qasm_simulator")
shots_run = 5024
job = execute(circuit,backend = backend_run,shots = shots_run)
result = job.result()
count = result.get_counts()
print(count)
qc = QuantumCircuit(2,2)
qc.h(0)
qc.x(1)
qc.measure([0,1],[0,1])
job_1 = execute(qc,backend = backend_run,shots = shots_run)
result_1 = job_1.result()
counts = result_1.get_counts()
print(counts)
plot_histogram(counts)<jupyter_output><empty_output><jupyter_text>Problems  1. {'11':1000} With the given inital state put a circuit in middle of the barrior to get the desired state<jupyter_code>prob_1 = QuantumCircuit(2,2)
prob_1.h([0,1])
prob_1.barrier()
####
#prob_1.h([0,1])
#prob_1.x([0,1])

###
prob_1.barrier()
prob_1.measure([0,1],[0,1])
prob_1.draw()

shots = 1000
job = execute(prob_1,backend = backend_run,shots = shots)
result = job.result()
counts = result.get_counts()
print(counts)
plot_histogram(counts)<jupyter_output>{'00': 261, '01': 261, '10': 243, '11': 235}<jupyter_text>2. {'1':1000}With the givin circuit make a circuit in between the barrier to get the desired output<jupyter_code>prob_2 = QuantumCircuit(2,1)
prob_2.h(0)
prob_2.barrier()
####

'''
Sai solution 
prob_2.cx(0,1)
prob_2.x(1)
prob_2.cx(1,0)

Abhay solution
prob_2.cx(0,1)
prob_2.cx(1,0)
prob_2.x(0)
'''
###
prob_2.barrier()
prob_2.measure(0,0)
prob_2.draw()

shots = 1000
job = execute(prob_2,backend = backend_run,shots = shots)
result = job.result()
counts = result.get_counts()
print(counts)
plot_histogram(counts)<jupyter_output>{'0': 508, '1': 492}<jupyter_text>3. {'00':250,'11':250,'10':500}With the givin circuit make a circuit in between the barrier to get the desired output<jupyter_code>prob_3 = QuantumCircuit(2,2)
prob_3.h([0,1])
prob_3.barrier()
####

###
prob_3.barrier()
prob_3.measure([0,1],[0,1])
prob_3.draw()
shots = 1000
job = execute(prob_3,backend = backend_run,shots = shots)
result = job.result()
counts = result.get_counts()
print(counts)
plot_histogram(counts)<jupyter_output>{'00': 253, '01': 249, '10': 257, '11': 241}
{'fraction_non_alphanumeric': 0.1602543720190779, 'fraction_numerical': 0.06391096979332274, 'mean_word_length': 6.9045226130653266, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '486746', 'license': 'Apache-2.0', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1247, 'n_words': 254, 'path': 'Day5_Programing_with_QISKIT/QCCI_Circuit_Day5.ipynb', 'repo_name': 'QCCI/Introduction_To_Quantum_Computation', 'size': '3145'}