Commit 39afd403 by BellCodeEditor

save project

parent d6c81a0f
Showing with 28 additions and 0 deletions
Windows PowerShell
版权所有 (C) 2009 Microsoft Corporation。保留所有权利。
PS C:\Users\yingxiaoming\Documents\lesson14_3> & C:/Users/yingxiaoming/AppData/Roaming/pythonWin/python.exe c:/Users/yingxiaoming/Documents/lesson14_3/diy2.py
60
75
PS C:\Users\yingxiaoming\Documents\lesson14_3>
import random
class Person:
def __init__(self,name,age,height):
self.level=1
self.name=name
self.age=age
self.height=height
def update(self):
self.level+=1
self.age+=1
self.height+=random.randint(3,15)
kaixin=Person('kaixin',10,60)
dad=Person('dad',50,200)
mom=Person('mom',50,110)
print(kaixin.height)
# print(dad.height)
# print(mom.height)
kaixin.update()
print(kaixin.height)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment