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
44b8f173
authored
Oct 31, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
eb6ff489
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
23 deletions
__pycache__/func1.cpython-37.pyc
demo.py
func1.py
__pycache__/func1.cpython-37.pyc
View file @
44b8f173
No preview for this file type
demo.py
View file @
44b8f173
try
:
#导入自己的模块
age
=
int
(
input
(
"输入您的年龄:"
))
import
func1
except
:
func1
.
new_input
()
print
(
"请输入一个整数"
)
\ No newline at end of file
else
:
if
age
<
18
:
print
(
"不可以喝酒"
)
else
:
print
(
"饮酒要适度"
)
finally
:
print
(
1
)
func1.py
View file @
44b8f173
def
score
():
#自定义函数
def
new_input
():
sum
=
0
#求和
total
=
[]
total
=
[]
while
True
:
while
True
:
try
:
unit
=
input
(
"请输入:"
)
unit
=
int
(
input
(
"请输入:"
))
if
unit
==
'q'
:
except
:
break
print
(
"请输入一个整数"
)
else
:
else
:
if
unit
==
"q"
:
try
:
break
unit
=
int
(
unit
)
except
:
print
(
"请输入一个整数"
)
else
:
else
:
total
.
append
(
unit
)
total
.
append
(
unit
)
for
i
in
total
:
print
(
total
)
sum
=
sum
+
i
score
()
return
sum
\ No newline at end of file
#调用函数
print
(
new_input
())
\ 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