Commit 21783ef1 by BellCodeEditor

auto save

parent 303bd2db
Showing with 22 additions and 6 deletions
class hero: class hero:
def __init__(self): def __init__(self,hp,attack):
self.level=1 self.level=1
self.hp=300 self.hp=hp
self.attack=200 self.attack=attack
daji=hero() daji=hero(300,200)
print(daji.attack)
\ No newline at end of file for i in range(1,10):
daji.level=i
daji.attack=daji.attack+100
daji.hp=daji.hp+50
print(daji.hp)
\ No newline at end of file
class cake:
def __init__(self,size,cream,fruit):
self.size1=size
self.cream1=cream
self.fruit1=fruit
birthday_cake1=cake(16,"plant_cream","apple")
birthday_cake2=cake(20,"pure_cream","chess")
print(birthday_cake1.size1)
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