Commit a7bd4f8d by BellCodeEditor

save project

parent bfbe2bd7
Showing with 10 additions and 15 deletions
filel=open("C:\\Users\\Administrator\\Desktop\\book.txt","a",encoding="utf-8") class Hero(object):
filel.write("小兰:12本\n") def __init__(self,name,hp,attack):
filel.write("小丽:11本\n") self.level=1
filel.write("李文:9本\n") self.name=name
filel.write("张伟:16本\n") self.hp=hp
filel.write("中凯:30本\n") self.attack=attack
filel.close() def combat(self,enemy):
with open("C:\\Users\\Administrator\\Desktop\\book.txt","a",encoding="utf-8") as enemy.hp-=self.name+"对"+enemy.name+"发起进攻"
filel: info1=self.name
filel.write("小兰:12本\n") \ No newline at end of file
filel.write("小丽:11本\n")
filel.write("李文:9本\n")
filel.write("张伟:16本\n")
filel.write("中凯:30本\n")
\ 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