I have defined a simple class but recieve the error AttributeError: 'NoneType' object has no attribute 'bar' when trying to use it. What am I doing wrong?
def Foo():
a = 0
def bar(self):
return self.a
f = Foo()
f.bar() # error
This is the syntax to define a function
def Foo():
to define a class you'd say
class Foo:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With