Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson12-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
df33adaa
authored
Apr 17, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
7070371a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
8 deletions
3.py
4.py
5.py
6.py
3.py
View file @
df33adaa
...
...
@@ -6,10 +6,12 @@ class Hero():
self
.
attack
=
attack
yase
=
Hero
(
"垭瑟"
,
300
,
20
,
1
)
houyi
=
Hero
(
"后羿"
,
250
,
23
,
1
)
print
(
yase
.
hp
)
def
Up_level
():
yase
.
level
=
yase
.
level
+
1
yase
.
hp
=
yase
.
hp
+
50
yase
.
attack
=
yase
.
attack
+
4
Up_level
()
print
(
yase
.
hp
)
\ No newline at end of file
n
=
input
(
"请输入要升级的人名:"
)
l
=
int
(
input
(
"请输入要要升多少级:"
))
print
(
int
(
n
.
hp
))
def
Up_level
(
i
,
up
):
i
.
level
=
i
.
level
+
up
i
.
hp
=
i
.
hp
+
up
*
50
i
.
attack
=
i
.
attack
+
up
*
4
Up_level
(
n
,
l
)
print
(
int
(
n
.
hp
))
\ No newline at end of file
4.py
0 → 100644
View file @
df33adaa
class
Hero
():
def
__init__
(
self
,
name
,
hp
,
attack
,
level
):
self
.
name
=
name
self
.
level
=
level
self
.
hp
=
hp
self
.
attack
=
attack
yase
=
Hero
(
"垭瑟"
,
300
,
20
,
1
)
houyi
=
Hero
(
"后羿"
,
250
,
23
,
1
)
print
(
"垭瑟升级前攻击:"
,
yase
.
attack
)
print
(
"垭瑟升级前血量:"
,
yase
.
hp
)
print
(
"垭瑟升级前等级:"
,
yase
.
level
)
def
Up_level
(
i
,
up
):
i
.
level
=
i
.
level
+
up
i
.
hp
=
i
.
hp
+
up
*
50
i
.
attack
=
i
.
attack
+
up
*
4
Up_level
(
yase
,
1
)
print
(
"-"
*
50
)
print
(
"垭瑟升级后攻击:"
,
yase
.
attack
)
print
(
"垭瑟升级后血量:"
,
yase
.
hp
)
print
(
"垭瑟升级后等级:"
,
yase
.
level
)
\ No newline at end of file
5.py
0 → 100644
View file @
df33adaa
import
urllib.request
import
urllib.parse
from
json
import
loads
url
=
"https://gitblock.cn/WebApi/Users/"
+
input
(
"请输入用户id:"
)
+
"/Get"
data
=
{
"key"
:
"value"
}
data
=
urllib
.
parse
.
urlencode
(
data
)
data
=
data
.
encode
()
response
=
urllib
.
request
.
urlopen
(
url
=
url
,
data
=
data
)
data
=
response
.
read
()
print
(
loads
(
data
.
decode
())[
"user"
][
"abstract"
])
\ No newline at end of file
6.py
0 → 100644
View file @
df33adaa
class
Hero
():
def
__init__
(
self
,
name
,
hp
,
attack
,
level
):
self
.
name
=
name
self
.
level
=
level
self
.
hp
=
hp
self
.
attack
=
attack
def
Up_level
(
i
,
up
):
i
.
level
=
i
.
level
+
up
i
.
hp
=
i
.
hp
+
up
*
50
i
.
attack
=
i
.
attack
+
up
*
4
yase
=
Hero
(
"垭瑟"
,
300
,
20
,
1
)
houyi
=
Hero
(
"后羿"
,
250
,
23
,
1
)
print
(
"垭瑟升级前攻击:"
,
yase
.
attack
)
print
(
"垭瑟升级前血量:"
,
yase
.
hp
)
print
(
"垭瑟升级前等级:"
,
yase
.
level
)
Up_level
(
yase
,
1
)
print
(
"-"
*
50
)
print
(
"垭瑟升级后攻击:"
,
yase
.
attack
)
print
(
"垭瑟升级后血量:"
,
yase
.
hp
)
print
(
"垭瑟升级后等级:"
,
yase
.
level
)
\ 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