Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson11_2
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
b02e9e90
authored
May 18, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
7eaed43a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
1.py
2.py
1.py
0 → 100644
View file @
b02e9e90
def
new_input
():
total
=
[]
while
True
:
unit
=
input
(
"请输入:"
)
if
unit
==
'q'
:
break
else
:
try
:
unit
=
int
(
unit
)
except
:
print
(
"请正确输入价格!"
)
else
:
total
.
append
(
unit
)
return
total
list
=
new_input
()
print
(
list
)
\ No newline at end of file
2.py
0 → 100644
View file @
b02e9e90
# if 条件判断如果不加重复执行只会执行一次
# 但是如果加了重复执行条件会一直判断不会结束 除非结束循环
#while 当的意思
#while为当后面的条件成立 循环执行它里面的内容 如果后面的条件不成立 就不执行里面的内容循环结束
a
=
3
while
a
<
10
:
print
(
a
<
10
)
a
=
a
+
1
a
y
/
n
3
<
10
True
4
<
10
True
9
<
10
True
10
<
10
False
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