Advertisements
Advertisements
Question
Explain the usage of keyword 'pass' in class definition.
Explain
Advertisements
Solution
The 'pass' statement is a null statement - it performs no action. It is used when a class body is temporarily empty, because Python requires an indented statement inside a class definition.
class Mobile:
pass
Here, Mobile is an empty class with no attributes or methods.
shaalaa.com
Is there an error in this question or solution?
