Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson11_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
7605a80f
authored
Oct 26, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
890f728d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
10 deletions
__pycache__/p.cpython-37.pyc
d.py
k.py
p.py
__pycache__/p.cpython-37.pyc
0 → 100644
View file @
7605a80f
File added
d.py
0 → 100644
View file @
7605a80f
M
=
"周末去玩"
key
=
"bxbcbhdhnjsiuissi"
k.py
0 → 100644
View file @
7605a80f
import
p
#p是上一个自定义模块的文件名
collection
=
p
.
new_input
()
zong
=
p
.
count
(
collection
)
print
(
"总分是"
+
str
(
zong
)
+
"分"
)
\ No newline at end of file
p.py
View file @
7605a80f
def
new_input
():
def
new_input
():
#定义第一个模块,收集数据
total
=
[]
col
=
[]
#col:collection(收集)
while
True
:
while
True
:
unit
=
input
(
'请输入(q退出):'
)
data
=
input
(
"请输入数据:"
)
if
unit
==
'q'
:
if
data
==
"stop"
:
break
break
else
:
else
:
try
:
try
:
unit
=
int
(
unit
)
data_1
=
int
(
data
)
except
:
except
:
print
(
"
请重新输入一个数字
"
)
print
(
"
注意格式,请输入数字!
"
)
else
:
else
:
total
.
append
(
unit
)
col
.
append
(
data_1
)
print
(
"-"
*
30
)
print
(
"____________________"
)
print
(
total
)
return
col
new_input
()
#调用函数
back_data
=
new_input
()
#back_data:返回的数据
print
(
back_data
)
def
count
(
t
):
#count:计算总数
w
=
0
for
i
in
t
:
w
=
w
+
i
print
(
w
)
return
w
count
(
back_data
)
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