Commit 1f5805db by BellCodeEditor

save project

parent c3c6bbfe
Showing with 9 additions and 6 deletions
...@@ -6,9 +6,12 @@ ...@@ -6,9 +6,12 @@
#with open(r'C:\Users\Administrator\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8')as file1: #with open(r'C:\Users\Administrator\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8')as file1:
#file1.writelines(final_sum) #file1.writelines(final_sum)
class Hero: class Hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.hp=300 self.name=name
self.attack=30 self.hp=hp
wukong = Hero() self.attack=attack
print(wukong.hp) wukong = Hero("悟空",200,40)
\ No newline at end of file yase = Hero("亚瑟",300,20)
print(wukong.hp)
print(yase.attack)
\ 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