adplus-dvertising
frame-decoration

Question

What is the output of the following code ?
class father:
    def __init__(self, param):
        self.o1 = param
 
class child(father):
    def __init__(self, param):
        self.o2 = param
 
>>>obj = child(22)
>>>print "%d %d" % (obj.o1, obj.o2)

a.

None None

b.

None 22

c.

22 None

d.

Error is generated

Posted under Strings in Python Python

Answer: (d).Error is generated

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following code ?