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
b6e98d16
authored
Sep 14, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
fdb363a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
18 deletions
diy.py
hello.py
diy.py
View file @
b6e98d16
class
Hero
:
def
__init__
(
self
,
name
,
level
,
hp
,
attack
):
self
.
name
=
name
self
.
level
=
level
self
.
hp
=
hp
self
.
attack
=
attack
def
upgrade
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
hp
+
50
self
.
attack
=
self
.
attack
+
4
yase
=
Hero
(
'亚瑟'
,
1
,
300
,
20
)
heyi
=
Hero
(
"后裔"
,
1
,
250
,
23
)
print
(
'亚瑟的血量为'
,
yase
.
hp
)
yase
.
upgrade
()
heyi
.
upgrade
()
class
dog
:
def
__init__
(
self
,
color
):
self
.
leg
=
4
self
.
eye
=
2
self
.
ear
=
2
self
.
color
=
color
a
=
dog
(
'red'
)
print
(
a
.
color
)
#self.attack=attack
# def upgrade(self):
# self.level=self.level+1
# self.hp=self.hp+50
# self.attack=self.attack+4
# yase=dog('亚瑟',1,300,20)
# heyi=Hero("后裔",1,250,23)
# print('亚瑟的血量为',yase.hp)
# yase.upgrade()
# heyi.upgrade()
print
(
'亚瑟的血量为'
,
yase
.
hp
)
print
(
'后裔的攻击力为'
,
heyi
.
attack
)
\ No newline at end of file
# print('亚瑟的血量为',yase.hp)
# print('后裔的攻击力为',heyi.attack)
\ No newline at end of file
hello.py
0 → 100644
View file @
b6e98d16
print
(
"hello world"
)
\ 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