Examveda

What will be the output of the following Python code?
class Demo:
    def __init__(self):
        pass
 
    def test(self):
        print(__name__)
 
obj = Demo()
obj.test()

A. Exception is thrown

B. __main__

C. Demo

D. test

Answer: Option B


This Question Belongs to Python Program >> Classes And Objects In Python

Join The Discussion

Related Questions on Classes and Objects in Python