Question DSA-BIT-0045
MediumWhat is the output of this code?
s = [1, 2, 3]
out = []
for mask in range(1 << len(s)):
out.append([s[i] for i in range(len(s)) if mask >> i & 1])
print(out[5], len(out))
- A.
[1, 2] 8
- B.
[1, 3] 8
- C.
Sign up free to see the answer and a step-by-step explanation.