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
48d2b495
authored
Dec 18, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d2b79974
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
func.py
func.py
View file @
48d2b495
def
er
():
def
er
():
try
:
#定义一个列表,用来存放价格
total
=
[]
total
=
[]
while
True
:
while
True
:
#提示用户输入,用unit变量接受输入的值
unit
=
int
(
input
(
'请输入‘按q退出'
))
if
unit
==
'q'
:
break
else
:
try
:
unit
=
int
(
unit
)
except
:
print
(
'请输入一个整数'
)
else
:
total
.
append
(
unit
)
print
(
total
)
return
total
except
:
er
()
print
(
'要输入整数'
)
\ No newline at end of file
else
:
unit
=
int
(
input
(
"请输入:"
))
if
unit
==
'q'
:
break
else
:
total
.
append
(
unit
)
print
(
total
)
er
()
\ 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