1.

To obtain a list of all the functions defined under sys module, which of the following functions can be used?(a) print(sys)(b) print(dir.sys)(c) print(dir[sys])(d) print(dir(sys))I got this question in a national level competition.This intriguing question comes from Sys Module topic in division Mapping Functions and Modules of Python

Answer»

Right option is (d) print(DIR(sys))

Easy EXPLANATION - The function print(dir(sys)) helps us to obtain a list of all the functions DEFINED under the sys MODULE. The function can be used to obtain the list of functions under any given module in Python.



Discussion

No Comment Found

Related InterviewSolutions