Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson11_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
e3729368
authored
Mar 28, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c20b6490
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
5 deletions
__pycache__/函数返回1值.cpython-37.pyc
函数返回1值.py
函数返回值.py → 读写 copy.py
调用.py
__pycache__/函数返回1值.cpython-37.pyc
0 → 100644
View file @
e3729368
File added
函数返回1值.py
0 → 100644
View file @
e3729368
def
num
():
def
num
():
total
=
[]
print
(
'按下q退出'
)
while
True
:
player
=
input
(
'输入价格:'
)
if
player
==
'q'
:
break
else
:
try
:
player
=
int
(
player
)
except
:
print
(
'请重新输入'
)
else
:
total
.
append
(
player
)
return
total
def
sum
(
money
):
count
=
0
#计算总和
for
i
in
money
:
count
+=
i
return
count
# print('一共消费'+str(pay)+'元')
函数返回值
.py
→
读写 copy
.py
View file @
e3729368
def
diancan
():
#创建函数
def
diancan
():
def
diancan
():
#创建函数
def
diancan
():
total
=
[]
total
=
[]
while
True
:
while
True
:
unit
=
input
(
"请输入:"
)
unit
=
input
(
"请输入:"
)
...
@@ -18,6 +18,6 @@ def sum(money):
...
@@ -18,6 +18,6 @@ def sum(money):
for
i
in
money
:
for
i
in
money
:
count
=
count
+
i
count
=
count
+
i
return
count
return
count
a
=
diancan
()
#使用函数
q
=
diancan
()
b
=
sum
(
a
)
w
=
sum
(
q
)
print
(
b
)
print
(
w
)
\ No newline at end of file
调用.py
0 → 100644
View file @
e3729368
import
函数返回
1
值
import
函数返回
1
值
a
=
函数返回
1
值
.
num
()
b
=
函数返回
1
值
.
sum
(
a
)
print
(
'一共消费'
+
str
(
b
)
+
'元'
)
\ 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