Note: These grading exercises are being validated against the test_challenge
in the grading service.
The following examples use the q-code-exercise
syntax in a markdown cell with grader-import
and grader-function
attributes:
# set variable to a prime number
prime_num = 317
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
qc.x(0) # Do X-gate on qubit 0
qc.y(1) # Do Y-gate on qubit 1
qc.z(1) # Do Z-gate on qubit 1
qc.draw()
The following examples use the q-code-exercise
syntax in a markdown cell with grader-id
and grader-answer
attributes
# set variable to a string of vowels
vowels = 'aeauioo'
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
qc.x(0) # Do X-gate on qubit 0
qc.y(1) # Do Y-gate on qubit 1
qc.z(1) # Do Z-gate on qubit 1
qc.draw()
The following examples use a code cell with grader_import
and grader_function
in the cell metadata
# set variable to a string of vowels
vowels2 = 'uieaoeauio'
from qiskit import QuantumCircuit
qc2 = QuantumCircuit(2)
qc2.x(0) # Do X-gate on qubit 0
qc2.y(1) # Do Y-gate on qubit 1
qc2.z(1) # Do Z-gate on qubit 1
qc2.draw()
The following examples use a code cell with grader_id
and grader_answer
in the cell metadata
# set variable to a prime number
prime_num_2 = 29
from qiskit import QuantumCircuit
qc2 = QuantumCircuit(2)
qc2.x(0) # Do X-gate on qubit 0
qc2.y(1) # Do Y-gate on qubit 1
qc2.z(1) # Do Z-gate on qubit 1
qc2.draw()