Fill in the blanks to make sayHi() a class method. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Fill in the blanks to make sayHi() a class method.

Looking for a hand here. class Person: def __init__(self, name): self.name = name ____________ # what goes here ___ sayHi(cls): # and at the start of here. print("Hi") I think that the first space is "def sayHi()" and I think I'm stumped for the second space.

22nd Jul 2020, 9:10 AM
Tyler Sandiford
Tyler Sandiford - avatar
3 Answers
+ 2
Only knowing the answers is not enough! You should know about classmethods! If not then go through the python course again In case feeling difficulty then try to make some codes If still having some doubt then use the forum Ask a question only when you don't find your solution after searching for similar questions to prevent duplicate questions!
22nd Jul 2020, 9:21 AM
Namit Jain
Namit Jain - avatar
0
Hey Granger, Thanks for your reply, I actually stumbled across the answer in another thread that is talking about a similar type of question. I'll be looking into understanding what @classmethod is for because it would seem I missed something.
22nd Jul 2020, 9:19 AM
Tyler Sandiford
Tyler Sandiford - avatar
0
answer plz
3rd Jun 2021, 5:44 PM
Iker