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
dd181fda
authored
Oct 18, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
e2a5bc03
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
28 deletions
__pycache__/j.cpython-37.pyc
f.py
func.py
j.py
l.py
t.py
__pycache__/j.cpython-37.pyc
0 → 100644
View file @
dd181fda
File added
f.py
0 → 100644
View file @
dd181fda
import
j
#func指代上一程序的文件名,根据实际修改
# 调用自定义的输入函数,实现分数输入的功能
data1
=
j
.
data
()
# 调用自定义的求和函数,计算需要支付的总价
score
=
j
.
total
(
data1
)
print
(
"这位选手的总分数为:"
+
str
(
score
)
+
"分"
)
func.py
View file @
dd181fda
total
=
[]
def
total
(
z
):
while
True
:
q
=
0
unit
=
input
(
"请输入:"
)
for
i
in
z
:
if
unit
==
'q'
:
q
=
q
+
i
break
print
(
q
)
else
:
return
(
q
)
total
.
append
(
unit
)
d
=
total
(
we
=
[
1
,
2
,
3
,
4
])
print
(
total
)
print
(
d
)
\ No newline at end of file
\ No newline at end of file
j.py
0 → 100644
View file @
dd181fda
def
data
():
z
=
[]
while
True
:
a
=
input
(
"输入价格"
)
if
a
==
"s"
:
break
else
:
try
:
a1
=
int
(
a
)
except
:
print
(
"格式错误,请输入数字"
)
else
:
z
.
append
(
a1
)
#print(z)
return
(
z
)
b
=
data
()
print
(
b
)
def
total
(
b
):
#z代表任意列表名
t
=
0
for
i
in
b
:
t
=
t
+
i
print
(
t
)
return
(
t
)
total
(
b
)
#调用函数,
l.py
View file @
dd181fda
q
=
[]
for
j
in
range
(
1
,
10
):
while
True
:
for
i
in
range
(
1
,
j
+
1
):
try
:
print
(
i
,
"*"
,
j
,
"="
,
i
*
j
,
sep
=
""
,
end
=
" "
)
age
=
int
(
input
(
"几岁了"
))
print
()
except
:
print
(
"要输入整数"
)
else
:
if
age
<
18
:
print
(
"不可以喝酒哦"
)
print
(
"结束"
)
menu
=
input
(
"你要点什么菜?"
)
if
menu
==
"stop"
:
break
else
:
q
.
append
(
menu
)
print
(
q
)
t.py
0 → 100644
View file @
dd181fda
import
j
f
=
j
.
data
()
g
=
j
.
total
(
f
)
print
(
"总分是"
+
str
(
g
)
+
"分"
)
\ 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