Junior — Senior
Error detection in a Python class (Example 2)
livecode
Task condition
Find the logical and syntactical errors in the following Python code snippet.
class A:
attr = 1
@classmethod
def cls_meth(cls, a):
return cls.attr + a
@staticmethod
def stc_meth(a):
return a * a
@property
def prop(self):
return self.attr
A.cls_meth(1)
A.stc_meth(1)
A.prop
a = A()
a.cls_meth(1)
na.stc_meth(1)
na.prop