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
a890f811
authored
Nov 03, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
44b8f173
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
7 deletions
__pycache__/func1.cpython-37.pyc
demo.py
func1.py
__pycache__/func1.cpython-37.pyc
View file @
a890f811
No preview for this file type
demo.py
View file @
a890f811
#导入自己的模块
import
func1
import
func1
func1
.
new_input
()
func1
.
new_input
()
\ No newline at end of file
func1.py
View file @
a890f811
#自定义函数
def
new_input
():
def
new_input
():
sum
=
0
#求和
total
=
[]
total
=
[]
sum1
=
0
#总和
while
True
:
while
True
:
unit
=
input
(
"请输入:"
)
unit
=
input
(
"请输入:"
)
if
unit
==
'q'
:
if
unit
==
'q'
:
...
@@ -14,7 +13,6 @@ def new_input():
...
@@ -14,7 +13,6 @@ def new_input():
else
:
else
:
total
.
append
(
unit
)
total
.
append
(
unit
)
for
i
in
total
:
for
i
in
total
:
sum
=
sum
+
i
sum1
+=
i
return
sum
return
sum1
#调用函数
print
(
new_input
())
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