# The same Bell pair in PennyLane, the open-source quantum library from Xanadu.
# This terminal can't install PennyLane, so run it on your own computer:
#   pip install pennylane
#   python3 pennylane_bell.py
import pennylane as qml

dev = qml.device("default.qubit", wires=2)


@qml.qnode(dev)
def bell():
    qml.Hadamard(wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.probs(wires=[0, 1])


print(qml.draw(bell)())
print("Chances of 00, 01, 10, 11:", [round(float(p), 3) for p in bell()])
