Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson11_5
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
2489bfde
authored
Feb 19, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
05e7d622
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
__pycache__/func.cpython-37.pyc
abc.py
func.py
__pycache__/func.cpython-37.pyc
0 → 100644
View file @
2489bfde
File added
abc.py
0 → 100644
View file @
2489bfde
import
func
a
=
func
.
put_money
()
b
=
func
.
get_allmoney
(
a
)
print
(
"分数为"
+
str
(
b
))
func.py
0 → 100644
View file @
2489bfde
# total = []
# while True:
# unit= input("请输入:")
# if unit== 'q':
# break
# else:
# total.append(unit)
# print(total)
def
put_money
():
wallet
=
[]
while
True
:
money
=
input
(
"输入整数价格(按'q'结算):"
)
if
money
==
"q"
:
print
(
"已退出"
)
break
try
:
int
(
money
)
wallet
.
append
(
money
)
print
(
"当前钱包内有:"
+
str
(
","
.
join
(
wallet
)))
except
:
print
(
"记得输入整数"
)
print
(
"-"
*
30
)
print
(
"结算:"
)
print
(
"当前钱包内有"
+
str
(
","
.
join
(
wallet
)))
return
wallet
result_wallet
=
put_money
()
#print(result_wallet)
def
get_allmoney
(
list
):
all_money
=
0
for
i
in
list
:
all_money
=
all_money
+
int
(
i
)
return
all_money
result_getallmoney
=
get_allmoney
(
result_wallet
)
print
(
"总和为:"
+
str
(
result_getallmoney
))
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