Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_2
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
41f4d963
authored
Aug 26, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
b0335891
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
2 deletions
diy.py
diy2.py
test.py
test.py4
diy.py
0 → 100644
View file @
41f4d963
# for y in range(1,10):
# for i in range(1,y+1):
# print("%d * %d = %d"%(i,y,i*y),end='')
# print(' ')
print
(
"0-100之间的偶数有:"
)
for
y
in
range
(
1
,
101
):
if
y
%
2
==
0
:
print
(
"
%
d"
%
y
)
diy2.py
View file @
41f4d963
...
@@ -8,4 +8,20 @@ class Hero:
...
@@ -8,4 +8,20 @@ class Hero:
# self.level+=1
# self.level+=1
# self.hp+=100
# self.hp+=100
# self.attack+=100
# self.attack+=100
yase
=
Hero
(
"亚瑟"
)
\ No newline at end of file
def
combat
(
self
,
enemy
):
enemy
.
hp
-=
self
.
attack
info1
=
self
.
name
+
"对"
+
enemy
.
name
+
'发起进攻,'
info2
=
'造成'
+
str
(
self
.
attack
)
+
'点伤害,'
if
enemy
.
hp
>
0
:
info3
=
enemy
.
name
+
'还剩下'
+
str
(
enemy
.
hp
)
+
'血量'
info
=
info1
+
info2
+
info3
print
(
info
)
else
:
info3
=
enemy
.
name
+
'阵亡,游戏结束'
info
=
info1
+
info2
+
info3
print
(
info
)
exit
()
yase
=
Hero
(
'亚瑟'
)
houyi
=
Hero
(
'后羿'
)
yase
.
combat
(
houyi
)
\ No newline at end of file
test.py
0 → 100644
View file @
41f4d963
# a=float(input("请输入体重"))
# b=float(input("请输入身高"))
# BML=a/(b*b)
# if BML<=18.4:
# print("偏瘦")
# elif 23.9>BML>18.5:
# print("正常")
# elif 24.0>BML>27.9:
# print("过重")
# elif BML>=28.0:
# print("肥胖")
num
=
50
a
=
int
(
input
(
"请输入1~100的整数"
))
if
a
==
num
:
print
(
"恭喜你,猜对了。"
)
elif
a
>
num
:
print
(
"猜大了"
)
elif
a
<
num
:
print
(
"猜小了"
)
test.py4
0 → 100644
View file @
41f4d963
input()
\ 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