Python 面向对象 编程(一)

class fuc:

    def multi(self,x):
        return x*x

    def greet(self, name):
        print ('i am',name)
lg = fuc()

lg.multi(5)
Out[46]: 25

lg.greet('luogan')
i am luogan
posted @ 2022-08-19 22:59  luoganttcc  阅读(14)  评论(0编辑  收藏  举报