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
db219a8f
authored
Nov 23, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
e9f63d83
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
20 deletions
__pycache__/函数返回值.cpython-37.pyc
func.py
函数返回值.py
和.py
读写.py
__pycache__/函数返回值.cpython-37.pyc
View file @
db219a8f
No preview for this file type
func.py
View file @
db219a8f
def
charu
():
def
charu
():
total
=
[]
total
=
[]
while
True
:
while
True
:
unit
=
input
(
"请输入:"
)
unit
=
input
(
"请输入:"
)
if
unit
==
'q'
:
if
unit
==
'q'
:
break
break
else
:
else
:
unit
=
int
(
unit
)
unit
=
int
(
unit
)
total
.
append
(
unit
)
total
.
append
(
unit
)
print
(
total
)
print
(
total
)
return
total
#返回total
return
total
#返回total
...
...
函数返回值.py
View file @
db219a8f
def
diancan
():
def
diancan
():
#创建函数
def
diancan
():
def
diancan
():
#创建函数
total
=
[]
total
=
[]
while
True
:
while
True
:
unit
=
input
(
"请输入:"
)
unit
=
input
(
"请输入:"
)
...
@@ -6,18 +6,18 @@ def diancan():
...
@@ -6,18 +6,18 @@ def diancan():
if
unit
==
'q'
:
if
unit
==
'q'
:
break
break
else
:
else
:
try
:
try
:
#尝试执行
unit
=
int
(
unit
)
unit
=
int
(
unit
)
#尝试执行把输入的unit转换成整数类型
except
:
except
:
print
(
"
输入的不是价格"
)
print
(
"
请重新输入一个数字"
)
#报错的话就会有重新输入的报错提示
else
:
else
:
total
.
append
(
unit
)
total
.
append
(
unit
)
#如果可以转换就在列表末尾添加输入的unit
return
total
return
total
def
sum
(
money
):
def
sum
(
money
):
count
=
0
count
=
0
for
i
in
money
:
for
i
in
money
:
count
=
count
+
i
count
=
count
+
i
return
count
return
count
a
=
diancan
()
a
=
diancan
()
#使用函数
b
=
sum
(
a
)
b
=
sum
(
a
)
print
(
b
)
print
(
b
)
\ No newline at end of file
和.py
0 → 100644
View file @
db219a8f
import
函数返回值
import
函数返回值
a
=
函数返回值
.
diancan
()
b
=
函数返回值
.
sum
()
\ No newline at end of file
读写.py
0 → 100644
View file @
db219a8f
++ "b/\350\257\273\345\206\231.py"
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