Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson14-diy2
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
4d453633
authored
Jul 31, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
b16f38f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
demo.py
二分查找.py
斐波那契数列.py
demo.py
0 → 100644
View file @
4d453633
# score = 99
# print(str(score))
# name = '悟空'
# print(int(name))
# break #退出循环
# exit() #结束
i
=
0
while
True
:
print
(
i
)
i
+=
1
if
i
==
5
:
break
\ No newline at end of file
二分查找.py
0 → 100644
View file @
4d453633
lista
=
[
1
,
3
,
9
,
12
,
32
,
41
,
45
,
62
,
75
,
77
,
82
,
95
,
100
,
120
,
130
,
143
,
123
,
1245
,
13456
,
131654
,
46464646
,
464646464
,
644654646656
,
45666768
]
lista
=
[
1
,
3
,
9
,
12
,
32
,
41
,
45
,
62
,
75
,
77
,
82
,
95
,
100
,
120
,
130
,
143
,
123
,
1245
,
13456
,
131654
,
46464646
,
464646464
,
644654646656
,
45666768
]
num
=
82
#查找的值
low
=
0
high
=
len
(
lista
)
-
1
while
True
:
mid
=
(
low
+
high
)
//
2
if
lista
[
mid
]
==
num
:
print
(
'找到了'
,
mid
)
break
elif
low
>
high
:
print
(
'没有找到'
)
break
elif
lista
[
mid
]
<
num
:
low
=
mid
+
1
else
:
high
=
mid
-
1
\ No newline at end of file
斐波那契数列.py
0 → 100644
View file @
4d453633
def
func
(
n
):
def
func
(
n
):
if
n
<=
2
:
return
1
else
:
value
=
func
(
n
-
1
)
+
func
(
n
-
2
)
return
value
n
=
3
while
True
:
if
func
(
n
)
>
20
:
print
(
'第'
,
n
,
'列斐波那契的值大于20'
)
break
n
+=
1
\ 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