Commit 2a78adc0 by BellCodeEditor

save project

parent 0a7b0048
Showing with 33 additions and 2 deletions
alist = [88, 75, 72, 82, 90, 85, 78, 91]
\ No newline at end of file
alist = [88, 75, 72, 82, 90, 85, 78, 91]
for i in range(0,len(alist)-1):
for i in range(0,len(alist)-1):
if alist[i]>alist[i+1]:
alist[i],alist[i+1]=alist[i+1],alist[i]
print(alist)
\ No newline at end of file
#移动0
import time
nums=[9,0,0,2,1,98,0,13,43,54534,0,234,2343,0]
start=time.time()
# def move_zero(list):
# for i in list:
# if i==0:
# list.remove(i)
# list.append(0)
def move_zero(list):
zero_list=[]
for i in list:
if i==0:
list.remove(i)
zero_list.append(0)
list+=zero_list
move_zero(nums)
end=time.time()
_time=end-start
print(nums)
print(_time)
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