LoginSignup
1
1

More than 3 years have passed since last update.

クラス

Posted at
class Person(object):
    def __init__(self, name):
        self.name = name

    def say_something(self):
        print('I am {}. Hello'.format(self.name))
        self.run(3)

    def run(self, num):
        print('run '*num)

person = Person('Tom')
person.say_something()
実行結果
I am Tom. Hello
run run run 
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1