Q18Numerical3 Marks28 Apr 2024
What is the output of the following snippet of code? Enter an integer as your answer.
```
def f_1(P, Q):
return len(P) == len(Q)
def f_2(P, Q):
return sum([P[i] * Q[i] for i in range(len(P))])
def f_3(P, Q):
return f_2(P, Q) == 0
collection = [[1, 0, -1], [0, 1, 0], [-1, 0, -1],
[0, 1, 0, 0], [0, 1, 1, 0, 0, 0]]
count = 0
for P in collection:
for Q in collection:
if f_1(P, Q):
if f_3(P, Q):
count += 1
print(count)
```
Press Enter to check.