Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 932 Bytes

day17.md

File metadata and controls

26 lines (23 loc) · 932 Bytes

第十七天

索引

  1. insort
import bisect

# A series of random numbers
values = [14, 85, 77, 26, 50, 45, 66, 79, 10, 3, 84, 77, 1]

print('New  Pos  Contents')
print('---  ---  --------')

l = []
for i in values:
    position = bisect.bisect(l, i)
    bisect.insort(l, i)
    print('{:3}  {:3}'.format(i, position), l)