What will be the output of the following Python code? P = ["A", "B"] Q = (0,…
2026
What will be the output of the following Python code?
P = ["A", "B"]
Q = (0, 1)
R = dict.fromkeys(P, Q)
print(R)
Answer: A. {'A': (0, 1), 'B': (0, 1)}
- A.
{'A': (0, 1), 'B': (0, 1)}
- B.
{'A': 0, 'B': 1}
- C.
{'A': 1, 'B': 0}
- D.
['A': (0, 1), 'B': (0, 1)]
Attempted by 305 students.
Show answer & explanation
Correct answer: A
Loading lesson…