Please help to debug Python Code

python

#1

Hi,

Below code is not working, please help me to remove the bug.

class Result(object):


def __init__(self, name, marks):
    self.name = name
    self.marks = marks
def marksheet(self):
    print self.name
    print self.marks

Amit = Result("Amit", 75)

Amit.marksheet

Thx,
Ravi


#2

Hi @Ravi, I hope your actual code contains the correct white-space indentations before the method definitions. Notice that marksheet is a method, so the call should be:

Amit.marksheet()

If that’s not the case, then plese post the exact error message that was displayed.