Commit 4f1cf862 by BellCodeEditor

auto save

parent f7e36ca8
Showing with 22 additions and 0 deletions
import time
start_time = time.time() #开始时间
list1 = []
for a in range(0, 1000):
for b in range(0, 1000):
list1.insert(-1, 0)
end_time = time.time() #结束时间
result = end_time - start_time
print('程序运行时间是',result)
\ No newline at end of file
alist = [20, 17, 9, 13, 5, 6]
for i in range(len(alist)-1): #i 比较几轮
for j in range(len(alist)-1-i): # j = 0 1 2 3 4 5 j索引
if alist[j]>alist[j+1]:
alist[j],alist[j+1] = alist[j+1],alist[j]
print(alist)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment