Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson11_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
8006f870
authored
Aug 16, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d1ced12b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
13 deletions
__pycache__/func.cpython-37.pyc
a1.py
func.py
__pycache__/func.cpython-37.pyc
0 → 100644
View file @
8006f870
File added
a1.py
0 → 100644
View file @
8006f870
import
func
a
=
func
.
new_input
()
func
.
total_price
(
a
)
\ No newline at end of file
func.py
View file @
8006f870
def
new_input
():
def
new_input
():
#收集分数
a
=
[]
total
=
[]
while
True
:
while
True
:
b
=
(
input
(
'请输入价格
:(退出请按q)'
))
price
=
(
input
(
'请输入分数
:(退出请按q)'
))
if
b
==
'q'
:
if
price
==
'q'
:
break
break
else
:
else
:
try
:
try
:
b
=
int
(
b
)
price
=
int
(
price
)
except
:
except
:
print
(
'请输入整数!'
)
print
(
'请输入整数!'
)
else
:
else
:
a
.
append
(
b
)
total
.
append
(
price
)
print
(
'-'
*
80
)
print
(
'-'
*
80
)
return
a
print
(
total
)
c
=
new_input
()
return
total
print
(
c
)
def
total
(
list1
):
#计算分数
for
i
in
c
:
a
=
0
print
(
i
,
end
=
' '
)
for
i
in
list1
:
print
()
a
+=
i
print
(
c
[
0
])
print
(
'一共'
+
str
(
a
)
+
'分'
)
#list2=new_input()
#total(list2)
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