Skip to content

Instantly share code, notes, and snippets.

@SaraM92
Created February 13, 2023 06:53
Show Gist options
  • Save SaraM92/922d09b51b0173add2e0e257bcf87875 to your computer and use it in GitHub Desktop.
Save SaraM92/922d09b51b0173add2e0e257bcf87875 to your computer and use it in GitHub Desktop.
#Import needed libraries
from qiskit import QuantumRegister, ClassicalRegister
from qiskit import QuantumCircuit, execute
#Define the qubits and classical bit
q = QuantumRegister(2,'q')
c = ClassicalRegister(2,'c')
#Create a circuit
circuit = QuantumCircuit(q,c)
#Add gates and measure
circuit.h(q[0])
circuit.cx(q[0],q[1])
circuit.measure(q,c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment