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
af68555b
authored
Apr 21, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
3b393db7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
func.py
func.py
View file @
af68555b
total
=
[]
def
new_input
():
#定义一个新函数
while
True
:
total
=
[]
#创建一个变量存放价格
unit
=
input
(
"请输入:"
)
while
True
:
#无限循环
if
unit
==
'q'
:
unit
=
input
(
'请输入(q退出):'
)
#输入的内容赋值给unit这个变量
break
if
unit
==
'q'
:
#如果输入的内容失q的话
else
:
break
#终止程序
total
.
append
(
unit
)
else
:
#否则
print
(
total
)
total
.
append
(
unit
)
#将输入的价格追加到total价格列表中
\ No newline at end of file
print
(
total
)
#打印价格的列表
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