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)}

  1. A.

    {'A': (0, 1), 'B': (0, 1)}

  2. B.

    {'A': 0, 'B': 1}

  3. C.

    {'A': 1, 'B': 0}

  4. D.

    ['A': (0, 1), 'B': (0, 1)]

Attempted by 303 students.

Show answer & explanation

Correct answer: A

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…