English

Explain the usage of keyword 'pass' in class definition.

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?
Chapter 3: Classes in Python - EXERCISE [Page 62]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 3 Classes in Python
EXERCISE | Q 6. | Page 62
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×