clsの引数の位置がおかしいと英訳のチェックと原因が知りたいです。よろしくおねがいいたします
python
1 # user_name = "olga" 2 # user_score = 10 3 4 5class User: 6 count = 0 7 def __init__(self, name): 8 User.count += 1 9 self.name = name 10 #インスタンスメソッド 11 def say_hi(self): 12 print("hi {0}".format(self.name)) 13 #クラスメソッド 14 def show_info(cls): 15 print("{0} instances".format(cls.count)) 16tom = User("tom") 17bob = User("bob") 18 19# tom.say_hi() 20# bob.say_hi() 21 22User.show_info() 23
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。