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
229967df
authored
Apr 21, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
024fb164
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
9 deletions
__pycache__/func.cpython-37.pyc
func.py
use.py
__pycache__/func.cpython-37.pyc
0 → 100644
View file @
229967df
File added
func.py
View file @
229967df
total
=
[]
def
func1
():
#返回用户输入的价格列表
while
True
:
total
=
[]
unit
=
input
(
"请输入:"
)
while
True
:
if
unit
==
'q'
:
try
:
#尝试用户输入是否错误
break
unit
=
int
(
input
(
"请输入:"
))
else
:
except
:
#用户输入的不是整数的情况(错误的时候)
total
.
append
(
unit
)
print
(
"数据输入错误"
)
print
(
total
)
else
:
#用户输入的是整数的情况(正确的情况)
\ No newline at end of file
if
unit
==
-
1
:
#如果输入的是-1,程序结束
print
(
"程序结束"
)
break
else
:
total
.
append
(
unit
)
return
total
def
sum
(
x
):
#返回 列表 x 中的数字的和
count
=
0
for
i
in
x
:
count
=
count
+
i
return
count
\ No newline at end of file
use.py
0 → 100644
View file @
229967df
import
turtle
def
tree
(
n
):
if
n
>=
10
:
pen
.
forward
(
n
)
pen
.
right
(
30
)
tree
(
n
-
10
)
pen
.
left
(
60
)
tree
(
n
-
10
)
pen
.
right
(
30
)
pen
.
up
()
pen
.
forward
(
n
*
(
-
1
))
pen
.
down
()
pen
=
turtle
.
Pen
()
pen
.
up
()
pen
.
goto
(
0
,
-
200
)
pen
.
color
(
"red"
)
pen
.
setheading
(
90
)
pen
.
down
()
tree
(
60
)
turtle
.
done
()
\ 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