Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson13-diy1
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
cc560baf
authored
Sep 19, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
92449b0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
diy1.py
diy2.py
diy1.py
View file @
cc560baf
#time时间模块sleep()\time()返回的值是秒,从1970-0-0-0
from
time
import
*
start_time
=
time
()
#初始时间
list1
=
[]
list1
=
[]
for
a
in
range
(
0
,
1000
):
for
a
in
range
(
0
,
1000000
):
for
b
in
range
(
0
,
1000
):
list1
.
append
(
0
)
list1
.
insert
(
0
,
0
)
end_time
=
time
()
\ No newline at end of file
print
(
"时间是"
,
end_time
-
start_time
)
\ No newline at end of file
diy2.py
0 → 100644
View file @
cc560baf
alist
=
[
12
,
13
,
2
,
3
,
5
,
7
,
1
,
6
,
44
,
4
,
23
,
56
]
#冒泡排序
#轮数
n
=
len
(
alist
)
-
1
#每一轮
for
i
in
range
(
n
):
#每一轮比较的次数
for
j
in
range
(
n
):
#逻辑判断--->>从小到大
if
alist
[
j
]
>
alist
[
j
+
1
]:
#变量互换
alist
[
j
],
alist
[
j
+
1
]
=
alist
[
j
+
1
],
alist
[
j
]
print
(
alist
)
\ 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