Vidyalelo
Python · Q79

MCQs for Python Dictionaries: Exam

Programming · Python · question 79

Q79

What will be the output of the following Python code? >>> a=i: 'A' + str(i) for i in range(5) >>> a

A.
An exception is thrown
B.
{0: 'A0', 1: 'A1', 2: 'A2', 3: 'A3', 4: 'A4'}
Answer
C.
{0: 'A', 1: 'A', 2: 'A', 3: 'A', 4: 'A'}
D.
{0: '0', 1: '1', 2: '2', 3: '3', 4: '4'}

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board