Skip to content

Instantly share code, notes, and snippets.

@SaraM92
Created February 13, 2023 07:15
Show Gist options
  • Save SaraM92/f12898fb8fe0071317b6e7dccb3931bc to your computer and use it in GitHub Desktop.
Save SaraM92/f12898fb8fe0071317b6e7dccb3931bc to your computer and use it in GitHub Desktop.
#Import needed libraries
import pennylane as qml
from pennylane import numpy as np
dev = qml.device("default.qubit", wires=2, shots=100)
#Create circuit
@qml.qnode(dev)
def circuit():
qml.Hadamard(wires=0)
qml.CNOT(wires=[0, 1])
return qml.sample(qml.PauliZ(0)), qml.sample(qml.PauliZ(1))
bellstate = circuit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment