Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson11_3
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
06e50ba1
authored
Dec 19, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
6d88eca4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
a.py
f.py
func.py
a.py
0 → 100644
View file @
06e50ba1
try
:
age
=
int
(
input
(
'你今年几岁了'
))
except
:
print
(
'要数'
)
print
(
'~~~~~'
)
\ No newline at end of file
f.py
0 → 100644
View file @
06e50ba1
import
random
choices
=
[
'石头'
,
'砂锅'
,
'水'
]
print
(
'???游戏'
)
player
=
input
(
'你出啥'
)
while
(
cpayer
!=
'退出'
):
computer
=
random
.
choice
(
choices
)
print
(((
'你'
+
player
)
+
'我'
)
+
computer
)
\ No newline at end of file
func.py
0 → 100644
View file @
06e50ba1
def
er
():
#定义一个列表,用来存放价格
total
=
[]
while
True
:
#提示用户输入,用unit变量接受输入的值
unit
=
input
(
'请输入‘按q退出'
)
if
unit
==
'q'
:
break
else
:
try
:
unit
=
int
(
unit
)
except
:
print
(
'请输入一个整数'
)
else
:
total
.
append
(
unit
)
print
(
total
)
return
total
price
=
er
()
print
(
"=========================================="
)
print
(
price
)
print
(
'我下面开始计算菜单的总价'
)
'''
思路:
遍历得到列表中的每个值,然后让他们相加
'''
#定义一个变量储存总价
sum
=
0
for
i
in
price
:
sum
+=
i
print
(
'菜单的总价格为:'
+
str
(
sum
))
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