用Python编写

用Python编写,第1张

随便写了一个参考一下吧:

class Role:
def __init__(self, name, height, weapon):
selfname = name
selfheight = height
selfweapon = weapon
def printInfo(self):
print('名字:%s  身高:%d  武器:%s' % (selfname, selfheight, selfweapon))
a = Role('孙悟空',170,'金箍棒')
b = Role('猪八戒',165,'九齿钉耙')
aprintInfo()
bprintInfo()

以上就是关于用Python编写全部的内容,包括:用Python编写、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/zz/10214609.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-06
下一篇 2023-05-06

发表评论

登录后才能评论

评论列表(0条)

保存