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
cfe14104
authored
Apr 14, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
5e5ee02f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
9 deletions
__pycache__/func.cpython-37.pyc
diy.py
func.py
swim.py
__pycache__/func.cpython-37.pyc
0 → 100644
View file @
cfe14104
File added
diy.py
View file @
cfe14104
def
abc
(
a
,
b
):
def
new_input
():
c
=
a
+
b
total
=
[]
return
c
while
True
:
s
=
abc
(
2
,
3
)
unit
=
input
(
'请输入(q退出):'
)
print
(
s
)
if
unit
==
'q'
:
\ No newline at end of file
break
else
:
try
:
unit
=
int
(
unit
)
except
:
print
(
"输入错误,请重新输入一个数字"
)
else
:
total
.
append
(
unit
)
return
total
list1
=
new_input
()
def
sum
(
money
):
s
=
0
for
i
in
money
:
s
+=
i
return
s
sss
=
sum
(
list1
)
print
(
sss
)
\ No newline at end of file
func.py
View file @
cfe14104
...
@@ -11,5 +11,13 @@ def new_input():
...
@@ -11,5 +11,13 @@ def new_input():
print
(
"请重新输入,要输入一个整数啊!"
)
print
(
"请重新输入,要输入一个整数啊!"
)
else
:
else
:
total
.
append
(
unit
)
total
.
append
(
unit
)
print
(
total
)
return
total
new_input
()
# list1=new_input()
\ No newline at end of file
# print(list1)
def
sum
(
money
):
count
=
0
#用来存储总价格
for
i
in
money
:
count
+=
i
return
count
# s=sum(list1)
# print(s)
\ No newline at end of file
swim.py
0 → 100644
View file @
cfe14104
import
func
data
=
func
.
new_input
()
score
=
func
.
sum
(
data
)
print
(
score
)
\ 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