Call a function from a class does not work

Viewed 14

I give a simple example and my question is how to fix it in order to recognize the function

class Test():
    def __init__(self,x):
        self.x = x

    def three(self):
        return 3* self.x
    
    def four_plus_three(self):
        y = three()
        return 4*self.x + y
    

t =Test(3)
t.four_plus_three()

it throws the error

NameError: name 'three' is not defined

0 Answers
Related