1.

Which of the following will never be displayed on executing print(random.choice({0: 1, 2: 3}))?(a) 0(b) 1(c) KeyError: 1(d) none of the mentionedI had been asked this question in my homework.This is a very interesting question from Random Module topic in division Mapping Functions and Modules of Python

Answer»

Correct answer is (a) 0

To EXPLAIN I would SAY: It will not print 0 but DICT[0] i.e. 1 MAY be printed.



Discussion

No Comment Found

Related InterviewSolutions