Commit cc560baf by BellCodeEditor

auto save

parent 92449b0c
Showing with 22 additions and 4 deletions
#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
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
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