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
36f731f3
authored
Jan 03, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
42c99e34
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
27 deletions
func.py
func.py
View file @
36f731f3
def
new_input
():
while
True
:
list1
=
[]
try
:
while
True
:
age
=
int
(
input
(
"请输入你的年龄:"
))
nuit
=
input
(
"请输入:"
)
except
:
if
nuit
==
'q'
:
print
(
"请输入数字:"
)
break
else
:
if
age
<
18
or
age
>
100
:
print
(
"不能喝酒哦!"
)
else
:
else
:
try
:
print
(
"可以喝酒!"
)
nuit
=
int
(
nuit
)
\ No newline at end of file
except
:
print
(
"请输入数字,不是非数字:"
)
else
:
list1
.
append
(
nuit
)
finally
:
print
(
'======================='
)
return
list1
def
sum
(
money
):
count
=
0
for
i
in
money
:
count
+=
i
return
count
if
"__name__"
==
"__main__"
:
price
=
new_input
()
total
=
sum
(
price
)
print
(
"菜价总数是:"
,
total
)
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