Commit e8862de7 by BellCodeEditor

save project

parent c2dcc87d
Showing with 11 additions and 26 deletions
import time
class hero: file=open(r"C:\Users\Administrator\Desktop\江思pig.txt","w",encoding='utf-8')
def __init__(self,name,hp,attack,level): file.write('江思pig你个大头鬼深金冰')
self.attack = attack file.close()
self.hp = hp with open(r"C:\Users\Administrator\Desktop\江思pig.txt","r",encoding='utf-8') as file:
self.level = level a=file.read()
self.name = name for data in file:
if '江思pig你个大头鬼深金冰' in data:
def uplevel(self): print("in it")
self.level = self.level + 1 data=data.replace('江思pig你个大头鬼深金冰')
self.hp = self.hp + 50 new+=date
self.attack = self.attack + 4
def printdata(self):
print(self.name,"level=",self.level)
print(self.name,"attack=",self.attack)
print(self.name,"hp=",self.hp)
yase = hero("yase",300,21,1)
houyi = hero("houyi",240,24,1)
yase.uplevel()
houyi.uplevel()
yase.printdata()
houyi.printdata()
\ 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