QuestionQ26

VerifiedAdvanced Object-Oriented Programming

Analyze the following snippet and determine whether the code is correct and/or which method should be identified as a class method.

Question Image

Choose two
Explanation

A static method receives no implicit instance argument, so self is undefined inside isElementCorrect; additionally, the if self.progress == 100 statement is missing its required colon. The method that reads cls.number_of_crosswords needs @classmethod, which supplies the class as cls when the method is called. Python Descriptor Guide

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!