What will be the output of the following Python code? A = [10, 20, 30] B = "U"…
2026
What will be the output of the following Python code?
A = [10, 20, 30]
B = "U"
D = dict.fromkeys(A, B)
print(D)
Answer: A. {10: 'U', 20: 'U', 30: 'U'}
- A.
{10: 'U', 20: 'U', 30: 'U'}
- B.
{10: 'U', 20: None, 30: None}
- C.
{10: None, 20: None, 30: None}
- D.
[(10, 'U'), (20, 'U'), (30, 'U')]
Attempted by 337 students.
Show answer & explanation
Correct answer: A
Loading lesson…