What is the output of the following Python code snippet?
class A:
@classmethod
def f(cls): return 'Cls'
print(A.f())
@classmethod
def f(cls): return 'Cls'
print(A.f())
Correct answer
A. Cls
5 views
A. Cls
5 views
A classmethod receives the class as its first argument.
Asked in: Python Interview OOP
https://docs.python.org/3/tutorial/classes.htmlNot sure why the answer is A? Ask here and get an explanation.