Commit 1dc3c562 by BellCodeEditor

auto save

parent f47689a4
Showing with 35 additions and 0 deletions
# import turtle
# pen=turtle.Pen()
# pen.shape("turtle")
# pen.pencolor("blue")
# pen.fillcolor("red")
# pen.begin_fill()
# for i in range(5):
# pen.forward(100)
# pen.right(144)
# pen.end_fill()
# pen.hideturtle()
# turtle.done()
# for i in range(1,5,2):
# print(i)
# list_name=["z","r",1,'3']
# dict_1={'zhangsang':23,'lisi':67,'wangwu':87}
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+100
houyi=Hero("后羿",400,50)
houyi.upgrade()
print(houyi.hp)
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