Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13-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
7d9a9a9b
authored
Jun 08, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
5ec53ebb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
diy.py
sum.py
diy.py
View file @
7d9a9a9b
new_wenjian
=
""
with
open
(
r"c:\Users\张颜\Desktop\word.txt"
,
"r"
,
encoding
=
'utf-8'
)
as
wenjian
:
a
=
wenjian
.
readlines
()
# print(a)
for
i
in
a
:
s
=
i
.
split
()
sum
=
0
#求和
for
n
in
s
[
1
:]:
sum
=
sum
+
int
(
n
)
new_wenjian
=
s
[
0
]
+
str
(
sum
)
#为什么只输出了最后一个人的人名和总价
with
open
(
r"c:\Users\张颜\Desktop\word.txt"
,
"a"
,
encoding
=
'utf-8'
)
as
wenjian
:
wenjian
.
writelines
(
new_wenjian
)
sum.py
0 → 100644
View file @
7d9a9a9b
import
random
a
=
0
b
=
0
c
=
0
d
=
0
e
=
0
a
=
random
.
randint
(
0
,
99
)
b
=
random
.
randint
(
0
,
99
)
c
=
random
.
randint
(
0
,
99
)
d
=
random
.
randint
(
0
,
99
)
e
=
random
.
randint
(
0
,
99
)
print
(
a
,
"+"
,
b
,
"-"
,
c
,
"*"
,
d
,
"/"
,
e
,
"=?"
)
#95 + 50 - 63 * 29 =? 29 + 52 - 75 * 32 =?
\ 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