Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson12-3
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
1225b027
authored
Dec 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
b475275a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
diy.py
pop.py
diy.py
View file @
1225b027
...
@@ -2,7 +2,29 @@
...
@@ -2,7 +2,29 @@
#ssj1=open('C:\\Users\\玛酷机器人\\Desktop\\test.txt','w',encoding='utf-8')
#ssj1=open('C:\\Users\\玛酷机器人\\Desktop\\test.txt','w',encoding='utf-8')
#ssj1.write('小兰:12本、小丽:11本、李文:9本、张伟:16本、')
#ssj1.write('小兰:12本、小丽:11本、李文:9本、张伟:16本、')
#ssj1.close()
#ssj1.close()
with
open
(
'C:
\\
Users
\\
玛酷机器人
\\
Desktop
\\
test.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
ssj1
:
# with open('C:\\Users\\玛酷机器人\\Desktop\\test.txt','r',encoding='utf-8')as ssj1:
for
data
in
ssj1
:
# for data in ssj1:
if
'小强:10本'
in
data
:
# if'小强:10本'in data:
print
(
'数据在文件中'
)
# print('数据在文件中')
# if'小兰:12本'in data:
# print('数据在文件中')
# import random
# a=random.randint(0,100)
# if a>90:
# print('A')
# elif a>80:
# print('B')
# elif a>70:
# print('D')
# else:
# print('D')
# a=[3,4,9,13]
# b=[i for i in a if i<=5]
# print(b)
import
random
a
=
int
(
input
(
'请输入一个数:'
))
if
a
%
2
==
0
:
print
(
'no'
)
else
:
print
(
'yes'
)
pop.py
0 → 100644
View file @
1225b027
class
Hero
:
def
__init__
(
self
,
name
):
self
.
level
=
1
self
.
hp
=
250
self
.
attack
=
40
self
.
name
=
name
def
combat
(
self
,
enemy
):
enemy
.
hp
-=
self
.
attack
info1
=
self
.
name
+
"对"
enemy
.
name
+
"发起进攻,"
info2
=
"造成"
+
str
(
self
.
attack
)
+
"点伤害,"
if
enemy
.
hp
>
0
info3
=
enemy
.
name
+
"还剩下"
+
srt
(
enemy
.
hp
)
+
"血量"
info
=
info1
+
info2
+
info3
print
(
info
)
else
:
info3
=
enemy
.
name
+
"阵亡,游戏结束"
info
=
info1
+
info2
+
info3
print
(
info
)
exit
()
\ 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