Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
693f5d17
authored
Mar 02, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5d7891c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
44 deletions
diy.py
diy3.py
diy998.py
diy.py
View file @
693f5d17
#chenlong=hero("chenlong",999,99)
#print(chenlong.hp)
#yase=hero("亚瑟",1800,200)
#xitele=hero("xitele",1000,290)
#geerdan=hero("geerdan",1600,199)
#print(yase.hp)class hero:
def
__init__
(
self
,
name
,
hp
,
attack
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
def
jjjb
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
hp
+
40
self
.
attack
=
self
.
attack
+
15
yase
=
hero
(
"yase"
,
1800
,
200
)
yase
.
jjjb
()
print
(
"等级为:"
,
yase
.
level
)
print
(
"血量为:"
,
yase
.
hp
)
print
(
"攻击力为:"
,
yase
.
attack
)
ab
=
hero
(
"ab"
,
1400
,
288
)
ab
.
jjjb
()
print
(
"等级为:"
,
ab
.
level
)
print
(
"血量为:"
,
ab
.
hp
)
print
(
"攻击力为:"
,
ab
.
attack
)
#print(yase.hp)
#xtl=hero("xtl",2000,170)
#laoba=hero("laoba",1200,280)
#erbi=hero("erbi",1200,280)
class
hero
:
def
__init__
(
self
):
def
__init__
(
self
,
name
,
hp
,
attack
):
self
.
level
=
1
self
.
hp
=
300
self
.
attack
=
2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
laoden
=
hero
print
(
laoden
)
\ No newline at end of file
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
def
jjjb
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
hp
+
40
self
.
attack
=
self
.
attack
+
15
yase
=
hero
(
"yase"
,
1800
,
200
)
yase
.
jjjb
()
print
(
"-------------------------"
)
print
(
"yase等级为:"
,
yase
.
level
)
print
(
"yase血量为:"
,
yase
.
hp
)
print
(
"yase攻击力为:"
,
yase
.
attack
)
ab
=
hero
(
"ab"
,
1400
,
288
)
ab
.
jjjb
()
print
(
"-------------------------"
)
print
(
"ab等级为:"
,
ab
.
level
)
print
(
"ab血量为:"
,
ab
.
hp
)
print
(
"ab攻击力为:"
,
ab
.
attack
)
a
=
hero
(
"a"
,
1600
,
228
)
a
.
jjjb
()
print
(
"-------------------------"
)
print
(
"a等级为:"
,
a
.
level
)
print
(
"a血量为:"
,
a
.
hp
)
print
(
"a攻击力为:"
,
a
.
attack
)
diy3.py
View file @
693f5d17
...
...
@@ -10,21 +10,8 @@ class hero:
#print(chenlong.hp)
yase
=
hero
(
"亚瑟"
,
1800
,
200
)
xitele
=
hero
(
"xitele"
,
1000
,
290
)
geerdan
=
hero
(
"geerdan"
,
1
6
00
,
199
)
geerdan
=
hero
(
"geerdan"
,
1
5
00
,
199
)
print
(
yase
.
hp
)
def
yase
():
yase
.
level
=
yase
.
level
+
1
yase
.
hp
=
yase
.
hp
+
40
yase
.
attack
=
yase
.
attack
+
15
def
xitele
():
xitele
.
level
=
xitele
.
level
+
1
xitele
.
hp
=
xitele
.
hp
+
60
xitele
.
attack
=
xitele
.
attack
+
29
def
geerdan
():
geerdan
.
level
=
geerdan
.
level
+
1
geerdan
.
hp
=
geerdan
.
hp
+
51
geerdan
.
attack
=
geerdan
.
attack
+
20
\ No newline at end of file
diy998.py
View file @
693f5d17
...
...
@@ -5,26 +5,45 @@ class hero:
self
.
hp
=
hp
self
.
attack
=
attack
def
jjjb
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
hp
+
40
self
.
attack
=
self
.
attack
+
15
yase
=
hero
(
"yase"
,
1800
,
200
)
yase
.
jjjb
()
print
(
"-------------------------"
)
print
(
"yase等级为:"
,
yase
.
level
)
print
(
"yase血量为:"
,
yase
.
hp
)
print
(
"yase攻击力为:"
,
yase
.
attack
)
ab
=
hero
(
"ab"
,
1400
,
288
)
ab
.
jjjb
()
print
(
"-------------------------"
)
print
(
"ab等级为:"
,
ab
.
level
)
print
(
"ab血量为:"
,
ab
.
hp
)
print
(
"ab攻击力为:"
,
ab
.
attack
)
a
=
hero
(
"a"
,
1600
,
228
)
a
.
jjjb
()
print
(
"-------------------------"
)
print
(
"a等级为:"
,
a
.
level
)
print
(
"a血量为:"
,
a
.
hp
)
print
(
"a攻击力为:"
,
a
.
attack
)
#print(yase.hp)
#xtl=hero("xtl",2000,170)
#laoba=hero("laoba",1200,280)
#erbi=hero("erbi",1200,280)
#chenlong=hero("chenlong",999,99)
#print(chenlong.hp)
yase
=
hero
(
"亚瑟"
,
1800
,
200
)
xitele
=
hero
(
"xitele"
,
1000
,
290
)
geerdan
=
hero
(
"geerdan"
,
1600
,
199
)
print
(
yase
.
hp
)
def
yase
():
yase
.
level
=
yase
.
level
+
1
yase
.
hp
=
yase
.
hp
+
40
yase
.
attack
=
yase
.
attack
+
15
def
xitele
():
xitele
.
level
=
xitele
.
level
+
1
xitele
.
hp
=
xitele
.
hp
+
60
xitele
.
attack
=
xitele
.
attack
+
29
def
geerdan
():
geerdan
.
level
=
geerdan
.
level
+
1
geerdan
.
hp
=
geerdan
.
hp
+
51
geerdan
.
attack
=
geerdan
.
attack
+
20
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment