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
f4f96936
authored
Aug 16, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
92449b0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
5 deletions
diy1.py
jjjjjjjjjj.py
xxxxxxx.py
diy1.py
View file @
f4f96936
list1
=
[]
for
a
in
range
(
0
,
1000
):
for
b
in
range
(
0
,
1000
):
list1
.
insert
(
0
,
0
)
\ No newline at end of file
# list1 = []
# for a in range(0, 1000):
# for b in range(0, 1000):
# list1.insert(0, 0)
# import time
# start_time = time.time()
# list1 = []
# print('开始时间为',start_time)
# for a in range(0, 1000):
# for b in range(0, 1000):
# list1.insert(-1,0)
# end_time = time.time()
# print('结束时间为',end_time)
# result = end_time - start_time
# print('总耗时',result)
# import time
# start_time = time.time()
# print('开始时间为',start_time)
# for a in range(0,1001):
# for b in range(0,1001):
# c = 1000 - a - b
# if a**2 + b**2 == c**2:
# print('a b c的值分别为:',a, b, c)
# end_time = time.time()
# print('结束时间为',end_time)
# result = end_time - start_time
# print('总耗时',result)
alist
=
[
12
,
15
,
20
,
15
,
34
,
66
,
17
,
9
,
13
,
8
,
611
,
55
,
88
,
564356
,
484
,
989
,
48
,
94
,
894
,
87
,
864
,
564564
,
54
,
56
,
454
,
89
]
n
=
len
(
alist
)
for
i
in
range
(
0
,
n
-
1
):
for
j
in
range
(
0
,
n
-
1
):
if
alist
[
j
]
>
alist
[
j
+
1
]:
alist
[
j
],
alist
[
j
+
1
]
=
alist
[
j
+
1
],
alist
[
j
]
print
(
alist
)
jjjjjjjjjj.py
0 → 100644
View file @
f4f96936
# def bubble_sort(l):
# for i in range(len(lst)):
# is_sorted = True
# unsorted_border = (len(lst) - i - 1) if i == 0 else unsorted_border
# for j in range(unsorted_border):
# if l[j] > l[j + 1]:
# print(l)
# is_sorted = False
# l[j],l[j+1]=l[j+1],l[j]
# lastIndex = j
# unsorted_border = lastIndex
# if is_sorted:
# break
# lst = [5,8,9,64,59,4554,54,984,4,4,7,489,489,4,84]
# bubble_sort((lst))
\ No newline at end of file
xxxxxxx.py
0 → 100644
View file @
f4f96936
def
mao_pao
(
num_list
):
num_len
=
len
(
num_list
)
for
j
in
range
(
num_len
):
sign
=
False
for
i
in
range
(
num_len
-
1
-
j
):
if
a
[
i
]
>
a
[
i
+
1
]:
a
[
i
],
a
[
i
+
1
]
=
a
[
i
+
1
],
a
[
i
]
sign
=
True
if
not
sign
:
break
if
__name__
==
'__main__'
:
a
=
[
1
,
3
,
4
,
2
,
6
,
9
,
12
,
3
,
22
]
mao_pao
(
a
)
print
(
a
)
\ 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