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
b41389bd
authored
Jan 17, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
5514e1de
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
diy.py
diy2.py
diy.py
0 → 100644
View file @
b41389bd
class
cat
:
def
__init__
(
self
,
type
,
color
,
price
)
self
.
footNum
=
4
self
.
type
=
type
self
.
color
=
color
self
.
price
=
price
self
.
many
=
many
def
say_price
(
self
):
print
(
"猫猫的价格为"
+
str
(
self
.
price
)
+
"元"
animal
=
Cat
(
"波斯猫"
,
"white"
,
4000
)
animal
.
say_price
()
\ No newline at end of file
diy2.py
View file @
b41389bd
...
...
@@ -9,16 +9,16 @@ class Hero():
def
upgrade
():
self
.
level
=
yase
.
level
+
1
self
.
hp
=
yase
.
hp
+
50
self
.
attack
=
yase
.
attack
+
4
def
upgrade
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
hp
+
50
self
.
attack
=
self
.
attack
+
4
yase
=
Hero
(
"亚瑟"
,
300
,
20
)
dorl
=
upgrade
()
print
(
"等级为:"
,
dorl
.
level
)
print
(
"血量为:"
,
dorl
.
hp
)
print
(
"攻击为:"
,
dorl
.
attack
)
yase
.
upgrade
()
print
(
"等级为:"
,
yase
.
level
)
print
(
"血量为:"
,
yase
.
hp
)
print
(
"攻击为:"
,
yase
.
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