All problems
Bell State Amplitude
Problem
Return the amplitude of the basis state |x, y> in the Bell state (|00> + |11>) / sqrt(2): 1 / sqrt(2) when x == y and 0.0 otherwise.
Hint
The Bell state is an equal superposition of only the aligned basis states.
Test cases
case 1
in: [0,0]
expected: 0.7071067811865475
case 2
in: [1,1]
expected: 0.7071067811865475
case 3
in: [0,1]
expected: 0
case 4
in: [1,0]
expected: 0
Starter codePython
import math
def bell_amplitude(x, y):
# Your code here
pass4 test cases · run your code against them in the editor