########################################
# ENTER YOUR NAME AND WISC EMAIL HERE: #
########################################

# Name: Rochelle Li
# Email: rli484@wisc.edu

event = "Qiskit Fall Fest"

## Write your code below here. Delete the current information and replace it with your own ##
## Make sure to write your information between the quotation marks!

name = "Rochelle Li"

age = "19"

school = "University of Wisconsin Madison"

## Now press the "Run" button in the toolbar above, or press Shift + Enter while you're active in this cell


## You do not need to write any code in this cell. Simply run this cell to see your information in a sentence. ##

print(f'My name is {name}, I am {age} years old, and I attend {school}.')


## Run this cell to make sure your grader is setup correctly

%set_env QC_GRADE_ONLY=true
%set_env QC_GRADING_ENDPOINT=https://qac-grading.quantum-computing.ibm.com

from qiskit import QuantumCircuit

# Create quantum circuit with 3 qubits and 3 classical bits
# (we'll explain why we need the classical bits later)
qc = QuantumCircuit(3,3)

# return a drawing of the circuit
qc.draw()  

## You don't need to write any new code in this cell, just run it

from qiskit import QuantumCircuit

qc = QuantumCircuit(3,3)

# measure all the qubits
qc.measure([0,1,2], [0,1,2])

qc.draw(output="mpl")

from qiskit.providers.aer import AerSimulator

# make a new simulator object
sim = AerSimulator()  

job = sim.run(qc)      # run the experiment
result = job.result()  # get the results

result.get_counts()    # interpret the results as a "counts" dictionary

from qiskit import QuantumCircuit
from qiskit.providers.aer import AerSimulator


## Write your code below here ##
qc = QuantumCircuit(4,4)
qc.measure([0,1,2,3], [0,1,2,3])


## Do not modify the code under this line ##

qc.draw()

sim = AerSimulator()   # make a new simulator object
job = sim.run(qc)      # run the experiment
result = job.result()  # get the results

answer1 = result.get_counts()

# Grader Cell: Run this to submit your answer

from qc_grader.challenges.fall_fest23 import grade_ex1a

grade_ex1a(answer1)

from qiskit import QuantumCircuit

qc = QuantumCircuit(2)

# We start by flipping the first qubit, which is qubit 0, using an X gate
qc.x(0)

# Next we add an H gate on qubit 0, putting this qubit in superposition.
qc.h(0)

# Finally we add a CX (CNOT) gate on qubit 0 and qubit 1
# This entangles the two qubits together
qc.cx(0, 1)

qc.draw(output="mpl")

from qiskit import QuantumCircuit

qc = QuantumCircuit(2, 2)


## Write your code below here ##
qc.h(0)
qc.cx(0,1)

    
## Do not modify the code under this line ##


answer2 = qc
qc.draw(output="mpl")

# Grader Cell: Run this to submit your answer

from qc_grader.challenges.fall_fest23 import grade_ex1b

grade_ex1b(answer2)