Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_4
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
60bb9f25
authored
Dec 23, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
0d21e6bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
diy2.py
diy2.py
View file @
60bb9f25
class
hero
:
class
xue
:
def
__init__
(
self
,
name
,
hp
,
attack
):
def
__init__
(
self
,
name
,
banji
,
xuehao
,
nianji
):
self
.
level
=
1
self
.
nianji
=
1
self
.
name
=
name
self
.
name
=
name
self
.
hp
=
hp
self
.
xuehao
=
xuehao
self
.
attack
=
attack
self
.
banji
=
banji
def
upgrade
(
self
):
def
upgrade
(
self
):
self
.
level
=
self
.
level
+
1
self
.
nianji
=
self
.
nianji
+
1
self
.
hp
=
self
.
hp
+
10000
self
.
attack
=
self
.
attack
+
909090
yase
=
hero
(
'亚瑟'
,
400000
,
4000
)
xiaoming
=
xue
(
'小明'
,
4
,
25
,
1
)
houyi
=
hero
(
'后裔'
,
3000
,
90000000000
)
xiaogang
=
xue
(
'小刚'
,
8
,
34
,
1
)
print
(
'亚瑟的hp'
+
str
(
yase
.
hp
))
print
(
'小明的banji'
+
str
(
xiaoming
.
banji
))
print
(
'后裔的name'
+
houyi
.
name
)
print
(
'小刚的年级'
+
str
(
xiaogang
.
nianji
))
yase
.
upgrade
()
xiaogang
.
upgrade
()
print
(
'等级为'
,
houyi
.
level
)
print
(
'第二年,小刚年级'
+
str
(
xiaogang
.
nianji
))
print
(
'hp为'
,
houyi
.
hp
)
print
(
'attack为'
,
houyi
.
attack
)
...
...
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