import numpy as np
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, Aer, IBMQ, assemble, execute
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *

# Loading your IBM Quantum account(s)
provider = IBMQ.load_account()

#Apply the CNOT gate to the 00 state
#
qc=QuantumCircuit(2,2)
#
qc.cx(0,1)
#
qc.draw()

#Apply the CNOT gate to the 10 state
#
qc=QuantumCircuit(2,2)
#
qc.x(0)
qc.cx(0,1)

#
qc.draw()

#Apply the CNOT gate to the 00 state
#
qc=QuantumCircuit(2,2)
#
qc.h(0)
qc.cx(0,1)
#

for i in range(2):
    qc.measure(i,i)


backend = Aer.get_backend('qasm_simulator') # we choose the simulator as our backend
counts = execute(qc, backend, shots = 1024).result().get_counts() # we run the simulation and get the counts
plot_histogram(counts) 


#Apply the CNOT gate to the 00 state
#
qc=QuantumCircuit(2,2)
#
# FILL YOUR CODE IN HERE

qc.h(0)
qc.z(0)
qc.x(1)
qc.cx(0,1)


for i in range(2):
    qc.measure(i,i)


backend = Aer.get_backend('qasm_simulator') # we choose the simulator as our backend
counts = execute(qc, backend, shots = 1024).result().get_counts() # we run the simulation and get the counts
plot_histogram(counts) 

