Q. What does the Python code: x = {1: ‘a’, 2: ‘b’}; print(x[1]) output?

A
1
B
a
C
b
D
Error
Solution:

The code accesses the value associated with key 1 in the dictionary, which is ‘a’.

Entri PDF Icon

Get Question Bank

Strengthen Your Practice with our comprehensive question bank.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!