Interview questions and answers
Ques: How are the functions help() and dir() different? Ans: These are the two functions that are accessible from the Python Interpreter. These two functions are used for viewing a consolidated dump of built-in functions. help : It will display the documentation string. It is used to see the help related to modules, keywords, attributes, etc. To view the help for a keyword, topics, you just need to type, help("<keyword>") dir : Without arguments, it will return list of names in the current local scope. With an argument, it will return a list of valid attributes for that object. Ques: Which statement of Python is used whenever a statement is required syntactically but the program needs no action? Ans: p ass is no-operation / action statement in Python. If we want to get data from a model and even if the requested data does not exist, we want to continue with other tasks. In such a scenario, use try-except block with pass statement i...