Advertisements
Advertisements
Question
Consider the following class definition:
class Yourclass
marks=10
name= "ABC"
def __init__(self,marks,name):
self.marks=marks
self.name=name
def display(self):
print marks
print name
Give the statement to create an object of class Yourclass.
Very Short Answer
Advertisements
Solution
YC = Yourclass(10, "ABC")
This passes 10 for marks and "ABC" for name to __init__.
shaalaa.com
Is there an error in this question or solution?
