Commit 6689e316 by BellCodeEditor

save project

parent 70a8a77b
Showing with 9 additions and 8 deletions
import random
hp=random.randint(57,85)
atk=random.randint(12,20)
class Fishermen:
def __init__(self,name,level,hp,atk):
self.level = 1
self.name = name
self.hp = hp
self.atk = atk
def levelup(self):
self.level+=1
self.hp+=hp
self.atk+=12
travelY=Fishermen('Ying',1,916,68)
travelK=Fishermen('Kong',1,968,64)
def levelup():
travelY.level+=1
travelY.hp+=57
travelY.atk+=12
levelup()
print(travelY.name,travelY.level,travelY.hp,travelY.atk)
\ No newline at end of file
travelY.levelup()
print(travelY.name,travelY.level,travelY.hp,travelY.atk)
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