首页 > 代码库 > python_集合 list_5
python_集合 list_5
>>> import random
>>> import time
>>> x=list(range(10000))
>>> y=set(range(10000))
>>> z=dict(zip(range(1000),range(10000)))
>>> r=random.randint(0,9999)
>>>
>>> start = time.time()
>>> for i in range(9999999):
r in y
>>> print(‘list,time used:‘,time.time()-start)
list,time used: 89.40382695198059
>>>
>>> start = time.time()
>>> for i in range(9999999):
r in z
>>> s={1,2,3}
>>> s.add(3)
>>> s.add(4)
>>> s
{1, 2, 3, 4}
>>> s.update({3,4})
>>> s
{1, 2, 3, 4}
>>> s.discard(5)
>>> s
{1, 2, 3, 4}
>>> s.pop()
1
>>> s.pop()
1
>>> a_set=set([8,9,10,11,12,13])
>>> b_set={0,1,2,3,7,8}
>>> a_set | b_set
{0, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13}
>>> a_set.union(b_set)
{0, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13}
>>> a_set & b_set
{8}
>>> a_set.intersection(b_set)
{8}
>>> a_set.difference(b_set)
{9, 10, 11, 12, 13}
>>> b_set.difference(a_set)
{0, 1, 2, 3, 7}
>>> a_set-b_set
{9, 10, 11, 12, 13}
>>> a_set+b_set
{0, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13}
>>> a_set ^ b_set
{0, 1, 2, 3, 7, 9, 10, 11, 12, 13}
>>> x={1,2,3}
>>> y={1,2,5}
>>> z={1,2,3,4}
>>> x<y
False
>>> x<z
True
>>> x.issubset(y)
False
>>> x.issubset(z)
True
>>> from enum import Enum
>>> class Color(Enum):
red=1
blue=2
green=3
>>> Color.red
<Color.red: 1>
>>> type(Color.red)
<enum ‘Color‘>
>>> isinstance(Color.red,Color)
True
>>> x=dict()
>>> x[Color.red]=‘red;‘
>>> x
{<Color.red: 1>: ‘red;‘}
>>> Color(2)
<Color.blue: 2>
>>> Color[‘red‘]
<Color.red: 1>
>>> r=Color.red
>>> r.name
‘red‘
>>> r.value
1
>>> list(Color)
[<Color.red: 1>, <Color.blue: 2>, <Color.green: 3>]
>>>
>>>
>>> import random
>>> listRandom=[random.choice(range(10000)) for i in range(100)]
>>> noRepeat=[]
>>> for i in listRandom:
if i not in noRepeat:
noRepeat.append(i)
>>> len(listRandom)
100
>>> len(noRepeat)
99
>>> newSet=set(listRandom)
>>> newSet
{1024, 3592, 8212, 1051, 3612, 5679, 2608, 8241, 1590, 6199, 4158, 4679, 3658, 596, 1628, 95, 3168, 5733, 3176, 1646, 2163, 5750, 4222, 5768, 7309, 6804, 8341, 8348, 3741, 1189, 1704, 1705, 2732, 7342, 693, 7351, 1208, 5831, 2249, 1229, 6863, 8912, 2776, 729, 5340, 736, 8937, 8427, 4851, 2294, 3830, 3852, 5904, 278, 7458, 2345, 2859, 2867, 307, 3381, 318, 5443, 3396, 1864, 859, 5472, 8032, 867, 4453, 1381, 8559, 5487, 6002, 6003, 4981, 6007, 6008, 3455, 2953, 1929, 9107, 7582, 9630, 4007, 432, 948, 1981, 5064, 9674, 4047, 464, 5074, 3029, 3031, 8664, 473, 2546, 5619, 9203}
>>> def RandomNumbers1(number,start,end):
data=http://www.mamicode.com/[]
while True:
element=random.randint(start,end)
if element not in data:
data.append(element)
if len(data)==number:
break
return data
>>> def RandomNumbers2(number,start,end):
data=http://www.mamicode.com/set()
while True:
element=random.randint(start,end)
data.add(element)
if len(data)==number:
return data
>>> start=time.time()
>>> for i in range(1000):
d1=RandomNumbers1(500,1,10000)
>>> print(‘Time used:‘,time.time()-start)
Time used: 105.95552897453308
>>> start=time.time()
>>> for i in range(1000):
d2=RandomNumbers2(500,1,10000)
print(‘Time used:‘,time.time()-start)
Time used: 58.47123694419861
Time used: 58.665674924850464
Time used: 58.76612305641174
Time used: 58.86567187309265
Time used: 58.96877884864807
Time used: 59.065202951431274
Time used: 59.16674089431763
Time used: 59.26578903198242
Time used: 59.366682052612305
Time used: 59.46695590019226
Time used: 59.56600499153137
Time used: 59.665075063705444
Time used: 59.76607394218445
Time used: 59.86568284034729
Time used: 59.96549892425537
Time used: 60.065978050231934
Time used: 60.16543889045715
Time used: 60.26496386528015
Time used: 60.36590003967285
Time used: 60.466222047805786
Time used: 60.564152002334595
Time used: 60.664571046829224
Time used: 60.7649450302124
Time used: 60.86411499977112
Time used: 60.964622020721436
Time used: 61.08355188369751
Time used: 61.1810839176178
Time used: 61.28202795982361
Time used: 61.38187289237976
Time used: 61.480247020721436
Time used: 61.580267906188965
Time used: 61.69981384277344
Time used: 61.795742988586426
Time used: 61.896530866622925
Time used: 62.01647186279297
Time used: 62.1115288734436
Time used: 62.21163296699524
Time used: 62.31207895278931
Time used: 62.41344690322876
Time used: 62.49547600746155
Time used: 62.5780348777771
Time used: 62.67706799507141
Time used: 62.76062202453613
Time used: 62.84649705886841
Time used: 62.961609840393066
Time used: 63.060566902160645
Time used: 63.1449019908905
Time used: 63.22789788246155
Time used: 63.311194896698
Time used: 63.39343786239624
Time used: 63.476011991500854
Time used: 63.57568097114563
Time used: 63.659595012664795
Time used: 63.74468803405762
Time used: 63.83310604095459
Time used: 63.927000999450684
Time used: 64.00932788848877
Time used: 64.09343385696411
Time used: 64.17826199531555
Time used: 64.25923085212708
Time used: 64.34283185005188
Time used: 64.43396997451782
Time used: 64.526113986969
Time used: 64.60787296295166
Time used: 64.69113087654114
Time used: 64.79095101356506
Time used: 64.87567806243896
Time used: 64.957927942276
Time used: 65.04185700416565
Time used: 65.12514400482178
Time used: 65.2079348564148
Time used: 65.29179906845093
Time used: 65.3751130104065
Time used: 65.45708584785461
Time used: 65.54030704498291
Time used: 65.62375402450562
Time used: 65.72502398490906
Time used: 65.80695295333862
Time used: 65.89076399803162
Time used: 65.97394394874573
Time used: 66.057452917099
Time used: 66.14262294769287
Time used: 66.22435092926025
Time used: 66.32450795173645
Time used: 66.40766906738281
Time used: 66.49145007133484
Time used: 66.57486200332642
Time used: 66.65680384635925
Time used: 66.7397608757019
Time used: 66.82365894317627
Time used: 66.90661406517029
Time used: 66.99066686630249
Time used: 67.07520794868469
Time used: 67.16689801216125
Time used: 67.25629901885986
Time used: 67.3416998386383
Time used: 67.42425584793091
Time used: 67.52334403991699
Time used: 67.60828399658203
Time used: 67.69020104408264
Time used: 67.77357196807861
Time used: 67.85773396492004
Time used: 67.94075083732605
Time used: 68.0246958732605
Time used: 68.12415790557861
Time used: 68.2071099281311
Time used: 68.291179895401
Time used: 68.38385701179504
Time used: 68.47450494766235
Time used: 68.55791401863098
Time used: 68.64085388183594
Time used: 68.72527503967285
Time used: 68.80759406089783
Time used: 68.89096403121948
Time used: 68.9828770160675
Time used: 69.07321906089783
Time used: 69.15787601470947
Time used: 69.24175500869751
Time used: 69.340744972229
Time used: 69.42320203781128
Time used: 69.50777101516724
Time used: 69.59275603294373
Time used: 69.675528049469
Time used: 69.75700998306274
Time used: 69.84107685089111
Time used: 69.94103598594666
Time used: 70.02349400520325
Time used: 70.10804390907288
Time used: 70.19958901405334
Time used: 70.2900800704956
Time used: 70.37389087677002
Time used: 70.45649886131287
Time used: 70.5419409275055
Time used: 70.62342691421509
Time used: 70.708016872406
Time used: 70.79017496109009
Time used: 70.87480401992798
Time used: 70.95772385597229
Time used: 71.04119491577148
Time used: 71.1247808933258
Time used: 71.20918798446655
Time used: 71.28998684883118
Time used: 71.37453889846802
Time used: 71.45713591575623
Time used: 71.54119896888733
Time used: 71.62382793426514
Time used: 71.71715784072876
Time used: 71.80746984481812
Time used: 71.89084005355835
Time used: 71.97496795654297
Time used: 72.07429385185242
Time used: 72.15705394744873
Time used: 72.24054503440857
Time used: 72.3246819972992
Time used: 72.40704488754272
Time used: 72.49206185340881
Time used: 72.57371401786804
Time used: 72.6572949886322
Time used: 72.7417688369751
Time used: 72.82328701019287
Time used: 72.90802884101868
Time used: 73.0087149143219
Time used: 73.09081101417542
Time used: 73.17314386367798
Time used: 73.25851392745972
Time used: 73.34015583992004
Time used: 73.42372989654541
Time used: 73.50753998756409
Time used: 73.60719203948975
Time used: 73.69133591651917
Time used: 73.77425289154053
Time used: 73.85787296295166
Time used: 73.94133687019348
Time used: 74.0256929397583
Time used: 74.10698986053467
Time used: 74.19117498397827
Time used: 74.27469396591187
Time used: 74.3578839302063
Time used: 74.45199990272522
Time used: 74.54124093055725
Time used: 74.6241729259491
Time used: 74.70788598060608
Time used: 74.80695390701294
Time used: 74.89109492301941
Time used: 74.97424006462097
Time used: 75.0579788684845
Time used: 75.14035892486572
Time used: 75.22412991523743
Time used: 75.30824303627014
Time used: 75.40891599655151
Time used: 75.49045300483704
Time used: 75.57411289215088
Time used: 75.66734099388123
Time used: 75.75865006446838
Time used: 75.8402910232544
Time used: 75.9235110282898
Time used: 76.00823783874512
Time used: 76.09117102622986
Time used: 76.17426991462708
Time used: 76.2671639919281
Time used: 76.35747504234314
Time used: 76.44026589393616
Time used: 76.52385807037354
Time used: 76.6241500377655
Time used: 76.70820498466492
Time used: 76.79022884368896
Time used: 76.87535405158997
Time used: 76.95799803733826
Time used: 77.04192399978638
Time used: 77.12452983856201
Time used: 77.20885896682739
Time used: 77.29138088226318
Time used: 77.37361693382263
Time used: 77.45669293403625
Time used: 77.55755496025085
Time used: 77.64222192764282
Time used: 77.7234959602356
Time used: 77.80678296089172
Time used: 77.89129996299744
Time used: 77.9742169380188
Time used: 78.0570478439331
Time used: 78.14136600494385
Time used: 78.22422385215759
Time used: 78.3070559501648
Time used: 78.4000358581543
Time used: 78.49019503593445
Time used: 78.57472205162048
Time used: 78.65740299224854
Time used: 78.7403039932251
Time used: 78.824697971344
Time used: 78.90901684761047
Time used: 78.99988603591919
Time used: 79.0920958518982
Time used: 79.17471599578857
Time used: 79.25755190849304
Time used: 79.3568868637085
Time used: 79.44175887107849
Time used: 79.52356195449829
Time used: 79.60748100280762
Time used: 79.69054102897644
Time used: 79.77391695976257
Time used: 79.85898685455322
Time used: 79.94154191017151
Time used: 80.02485299110413
Time used: 80.11032295227051
Time used: 80.19168996810913
Time used: 80.29004001617432
Time used: 80.37510895729065
Time used: 80.45709204673767
Time used: 80.54168891906738
Time used: 80.624685049057
Time used: 80.70804595947266
Time used: 80.79115891456604
Time used: 80.87561798095703
Time used: 80.95707488059998
Time used: 81.04218697547913
Time used: 81.13480997085571
Time used: 81.2235779762268
Time used: 81.30787706375122
Time used: 81.39117884635925
Time used: 81.47345399856567
Time used: 81.55768585205078
Time used: 81.64060497283936
Time used: 81.73430585861206
Time used: 81.82434797286987
Time used: 81.90772986412048
Time used: 81.99180889129639
Time used: 82.09044694900513
Time used: 82.17499494552612
Time used: 82.25905990600586
Time used: 82.34171199798584
Time used: 82.42553186416626
Time used: 82.50692892074585
Time used: 82.59255385398865
Time used: 82.69103002548218
Time used: 82.77381205558777
Time used: 82.85794401168823
Time used: 82.95068097114563
Time used: 83.04035496711731
Time used: 83.12508487701416
Time used: 83.20831489562988
Time used: 83.29051494598389
Time used: 83.37394499778748
Time used: 83.45914697647095
Time used: 83.54038596153259
Time used: 83.62611699104309
Time used: 83.7083568572998
Time used: 83.79162001609802
Time used: 83.87394404411316
Time used: 83.95802092552185
Time used: 84.04036593437195
Time used: 84.12376284599304
Time used: 84.20787286758423
Time used: 84.29157590866089
Time used: 84.37487888336182
Time used: 84.46906900405884
Time used: 84.55703592300415
Time used: 84.64188694953918
Time used: 84.72361207008362
Time used: 84.82493686676025
Time used: 84.90718388557434
Time used: 84.99134683609009
Time used: 85.07505583763123
Time used: 85.1583309173584
Time used: 85.24202990531921
Time used: 85.32590293884277
Time used: 85.42522287368774
Time used: 85.50750994682312
Time used: 85.59246706962585
Time used: 85.68435096740723
Time used: 85.77539992332458
Time used: 85.85729598999023
Time used: 85.94127988815308
Time used: 86.02402305603027
Time used: 86.10702395439148
Time used: 86.19111204147339
Time used: 86.27415895462036
Time used: 86.35716986656189
Time used: 86.4407570362091
Time used: 86.5237090587616
Time used: 86.60838389396667
Time used: 86.69092106819153
Time used: 86.7762758731842
Time used: 86.8592460155487
Time used: 86.94164490699768
Time used: 87.02443194389343
Time used: 87.10911393165588
Time used: 87.20219898223877
Time used: 87.29086804389954
Time used: 87.37399101257324
Time used: 87.45735692977905
Time used: 87.558109998703
Time used: 87.64171004295349
Time used: 87.72494888305664
Time used: 87.80846905708313
Time used: 87.8918399810791
Time used: 87.97520303726196
Time used: 88.05734705924988
Time used: 88.14112591743469
Time used: 88.22597193717957
Time used: 88.30821990966797
Time used: 88.39170384407043
Time used: 88.49082899093628
Time used: 88.5750379562378
Time used: 88.65832495689392
Time used: 88.7413899898529
Time used: 88.82407999038696
Time used: 88.90879392623901
Time used: 88.9915599822998
Time used: 89.09072089195251
Time used: 89.17410588264465
Time used: 89.25802683830261
Time used: 89.34104084968567
Time used: 89.42408585548401
Time used: 89.51071000099182
Time used: 89.5913999080658
Time used: 89.67565488815308
Time used: 89.75812697410583
Time used: 89.84184384346008
Time used: 89.93519306182861
Time used: 90.02438998222351
Time used: 90.10860085487366
Time used: 90.19150185585022
Time used: 90.29150605201721
Time used: 90.37574100494385
Time used: 90.45849585533142
Time used: 90.54166603088379
Time used: 90.62406992912292
Time used: 90.70862197875977
Time used: 90.79092597961426
Time used: 90.89068484306335
Time used: 90.97442102432251
Time used: 91.05881094932556
Time used: 91.16955304145813
Time used: 91.25864887237549
Time used: 91.34186005592346
Time used: 91.42404294013977
Time used: 91.50727701187134
Time used: 91.59175205230713
Time used: 91.67451405525208
Time used: 91.76695394515991
Time used: 91.85736799240112
Time used: 91.94102096557617
Time used: 92.02645206451416
Time used: 92.12542796134949
Time used: 92.20848894119263
Time used: 92.2910418510437
Time used: 92.37574791908264
Time used: 92.45724606513977
Time used: 92.5420868396759
Time used: 92.62412905693054
Time used: 92.72618389129639
Time used: 92.80746603012085
Time used: 92.89197492599487
Time used: 92.98476791381836
Time used: 93.07466006278992
Time used: 93.15821290016174
Time used: 93.24196004867554
Time used: 93.32590889930725
Time used: 93.40758395195007
Time used: 93.49188303947449
Time used: 93.58476686477661
Time used: 93.67430186271667
Time used: 93.7575318813324
Time used: 93.84237694740295
Time used: 93.94154191017151
Time used: 94.02521395683289
Time used: 94.10872006416321
Time used: 94.19258689880371
Time used: 94.27414393424988
Time used: 94.35760498046875
Time used: 94.44191002845764
Time used: 94.54320192337036
Time used: 94.6245129108429
Time used: 94.70863604545593
Time used: 94.80039191246033
Time used: 94.89185905456543
Time used: 94.97601103782654
Time used: 95.05755591392517
Time used: 95.1408679485321
Time used: 95.2256109714508
Time used: 95.30970191955566
Time used: 95.39114689826965
Time used: 95.47592186927795
Time used: 95.55713987350464
Time used: 95.64140486717224
Time used: 95.72429203987122
Time used: 95.80752301216125
Time used: 95.89114499092102
Time used: 95.9745090007782
Time used: 96.05846691131592
Time used: 96.14297986030579
Time used: 96.2251398563385
Time used: 96.31900191307068
Time used: 96.4077730178833
Time used: 96.49180197715759
Time used: 96.57534289360046
Time used: 96.67543506622314
Time used: 96.75898599624634
Time used: 96.84101295471191
Time used: 96.9250819683075
Time used: 97.0085039138794
Time used: 97.09189200401306
Time used: 97.17651200294495
Time used: 97.25768089294434
Time used: 97.34206104278564
Time used: 97.42529797554016
Time used: 97.50907588005066
Time used: 97.60848093032837
Time used: 97.69191098213196
Time used: 97.77515196800232
Time used: 97.85865592956543
Time used: 97.94091606140137
Time used: 98.02548885345459
Time used: 98.10759687423706
Time used: 98.20829892158508
Time used: 98.29200196266174
Time used: 98.37432098388672
Time used: 98.45871901512146
Time used: 98.54280400276184
Time used: 98.62564992904663
Time used: 98.707692861557
Time used: 98.79233598709106
Time used: 98.87462401390076
Time used: 98.95867204666138
Time used: 99.05054903030396
Time used: 99.14162588119507
Time used: 99.22571587562561
Time used: 99.30910992622375
Time used: 99.40899991989136
Time used: 99.49204087257385
Time used: 99.5766658782959
Time used: 99.66024398803711
Time used: 99.74111890792847
Time used: 99.82432794570923
Time used: 99.90894484519958
Time used: 99.99194598197937
Time used: 100.07612586021423
Time used: 100.15891599655151
Time used: 100.24093389511108
Time used: 100.34147691726685
Time used: 100.42437791824341
Time used: 100.50762891769409
Time used: 100.5918140411377
Time used: 100.67490291595459
Time used: 100.75791788101196
Time used: 100.84145402908325
Time used: 100.941477060318
Time used: 101.02488684654236
Time used: 101.10849189758301
Time used: 101.19232606887817
Time used: 101.2747368812561
Time used: 101.35888004302979
Time used: 101.4411849975586
Time used: 101.52533793449402
Time used: 101.60899496078491
Time used: 101.69182586669922
Time used: 101.78447794914246
Time used: 101.8762538433075
Time used: 101.95873403549194
Time used: 102.04128694534302
Time used: 102.14379096031189
Time used: 102.22583985328674
Time used: 102.3097288608551
Time used: 102.39130592346191
Time used: 102.47650599479675
Time used: 102.55816698074341
Time used: 102.6414430141449
Time used: 102.74183487892151
Time used: 102.82494807243347
Time used: 102.90906500816345
Time used: 103.00089406967163
Time used: 103.0925669670105
Time used: 103.1767418384552
Time used: 103.25896000862122
Time used: 103.34229588508606
Time used: 103.42564702033997
Time used: 103.50879883766174
Time used: 103.6018488407135
Time used: 103.69116497039795
Time used: 103.77483797073364
Time used: 103.85773801803589
Time used: 103.958988904953
Time used: 104.04241895675659
Time used: 104.1263780593872
Time used: 104.20959687232971
Time used: 104.29151701927185
Time used: 104.37470698356628
Time used: 104.45907092094421
Time used: 104.55860185623169
Time used: 104.64153289794922
Time used: 104.72673392295837
Time used: 104.8173840045929
Time used: 104.90797090530396
Time used: 104.99272584915161
Time used: 105.07477402687073
Time used: 105.15905499458313
Time used: 105.24101185798645
Time used: 105.32569885253906
Time used: 105.40824890136719
Time used: 105.49357295036316
Time used: 105.57561588287354
Time used: 105.65775394439697
Time used: 105.74117183685303
Time used: 105.82470202445984
Time used: 105.90789604187012
Time used: 105.99184894561768
Time used: 106.07531690597534
Time used: 106.15918898582458
Time used: 106.24205493927002
Time used: 106.33607006072998
Time used: 106.42461490631104
Time used: 106.50807285308838
Time used: 106.59172105789185
Time used: 106.69177198410034
Time used: 106.77629590034485
Time used: 106.85853791236877
Time used: 106.94238185882568
Time used: 107.0259280204773
Time used: 107.10833191871643
Time used: 107.19319486618042
Time used: 107.29308795928955
Time used: 107.37607383728027
Time used: 107.45788407325745
Time used: 107.55161905288696
Time used: 107.64123487472534
Time used: 107.72470188140869
Time used: 107.80805897712708
Time used: 107.89199995994568
Time used: 107.97535586357117
Time used: 108.05932092666626
Time used: 108.1413049697876
Time used: 108.2258620262146
Time used: 108.30808401107788
Time used: 108.39153385162354
Time used: 108.47693800926208
Time used: 108.55837202072144
Time used: 108.64205002784729
Time used: 108.7254638671875
Time used: 108.8089370727539
Time used: 108.89351892471313
Time used: 108.97678685188293
Time used: 109.06914401054382
Time used: 109.15831685066223
Time used: 109.24178099632263
Time used: 109.32486295700073
Time used: 109.42531704902649
Time used: 109.50883388519287
Time used: 109.59271788597107
Time used: 109.67588496208191
Time used: 109.75814294815063
Time used: 109.84254002571106
Time used: 109.9281849861145
Time used: 110.0094518661499
Time used: 110.09245896339417
Time used: 110.17728900909424
Time used: 110.25922989845276
Time used: 110.35991787910461
Time used: 110.4427080154419
Time used: 110.52488398551941
Time used: 110.60815906524658
Time used: 110.69375705718994
Time used: 110.7759439945221
Time used: 110.85828685760498
Time used: 110.95929002761841
Time used: 111.0433189868927
Time used: 111.12583899497986
Time used: 111.20941591262817
Time used: 111.2914650440216
Time used: 111.37600684165955
Time used: 111.45987105369568
Time used: 111.5415689945221
Time used: 111.62589502334595
Time used: 111.70881700515747
Time used: 111.80192685127258
Time used: 111.89134883880615
Time used: 111.97624087333679
Time used: 112.05877590179443
Time used: 112.16037487983704
Time used: 112.24338293075562
Time used: 112.32472896575928
Time used: 112.40866303443909
Time used: 112.49384188652039
Time used: 112.57676291465759
Time used: 112.66110801696777
Time used: 112.7580668926239
Time used: 112.84167385101318
Time used: 112.92570185661316
Time used: 113.01841497421265
Time used: 113.10890007019043
Time used: 113.1936719417572
Time used: 113.27461290359497
Time used: 113.35815501213074
Time used: 113.44162392616272
Time used: 113.52620601654053
Time used: 113.61777400970459
Time used: 113.70941185951233
Time used: 113.79246807098389
Time used: 113.8758819103241
Time used: 113.97517991065979
Time used: 114.05968403816223
Time used: 114.14240789413452
Time used: 114.22689390182495
Time used: 114.30815386772156
Time used: 114.39196395874023
Time used: 114.47482085227966
Time used: 114.57580900192261
Time used: 114.6594488620758
Time used: 114.74255585670471
Time used: 114.8352119922638
Time used: 114.92707800865173
Time used: 115.00953006744385
Time used: 115.09271287918091
Time used: 115.17710089683533
Time used: 115.25950002670288
Time used: 115.34220600128174
Time used: 115.42594194412231
Time used: 115.50943183898926
Time used: 115.59350490570068
Time used: 115.67617702484131
Time used: 115.75901198387146
Time used: 115.84142398834229
Time used: 115.92614102363586
Time used: 116.0093719959259
Time used: 116.09176707267761
Time used: 116.17577886581421
Time used: 116.25893688201904
Time used: 116.35203790664673
Time used: 116.44159007072449
Time used: 116.526202917099
Time used: 116.609384059906
Time used: 116.70859885215759
Time used: 116.79302501678467
Time used: 116.87629103660583
Time used: 116.95925903320312
Time used: 117.0426778793335
Time used: 117.12725400924683
Time used: 117.21023488044739
Time used: 117.29229784011841
Time used: 117.37512588500977
Time used: 117.4605438709259
Time used: 117.54172492027283
Time used: 117.64238905906677
Time used: 117.72561883926392
Time used: 117.81009197235107
Time used: 117.89175605773926
Time used: 117.9762659072876
Time used: 118.05956101417542
Time used: 118.14186906814575
Time used: 118.24231004714966
Time used: 118.32636594772339
Time used: 118.40856599807739
Time used: 118.49160885810852
Time used: 118.57615685462952
Time used: 118.65975093841553
Time used: 118.74269390106201
Time used: 118.82626104354858
Time used: 118.90992403030396
Time used: 118.992506980896
Time used: 119.08579993247986
Time used: 119.17686486244202
Time used: 119.26326084136963
Time used: 119.34363794326782
Time used: 119.44165802001953
Time used: 119.52544498443604
Time used: 119.61009192466736
Time used: 119.69316005706787
Time used: 119.7763659954071
Time used: 119.85966897010803
Time used: 119.94331884384155
Time used: 120.02653098106384
Time used: 120.10928988456726
Time used: 120.19297003746033
Time used: 120.27628207206726
Time used: 120.37574601173401
Time used: 120.45867085456848
Time used: 120.54333186149597
Time used: 120.626394033432
Time used: 120.71032094955444
Time used: 120.79263186454773
Time used: 120.87573194503784
Time used: 120.95953488349915
Time used: 121.04280185699463
Time used: 121.12785005569458
Time used: 121.21855401992798
Time used: 121.30943989753723
Time used: 121.39167499542236
Time used: 121.47731184959412
Time used: 121.5609278678894
Time used: 121.64297103881836
Time used: 121.72723484039307
Time used: 121.81867504119873
Time used: 121.90913605690002
Time used: 121.99261498451233
Time used: 122.07632994651794
Time used: 122.17530298233032
Time used: 122.25956702232361
Time used: 122.34254503250122
Time used: 122.4262158870697
Time used: 122.50912189483643
Time used: 122.5938789844513
Time used: 122.67645001411438
Time used: 122.77727103233337
Time used: 122.85846590995789
Time used: 122.94316792488098
Time used: 123.03558301925659
Time used: 123.12585496902466
Time used: 123.20928692817688
Time used: 123.29285597801208
Time used: 123.37616205215454
Time used: 123.45919394493103
Time used: 123.54306101799011
Time used: 123.62562990188599
Time used: 123.71056890487671
Time used: 123.79286289215088
Time used: 123.87646985054016
Time used: 123.95874404907227
Time used: 124.04203796386719
Time used: 124.12757897377014
Time used: 124.20967984199524
Time used: 124.29189801216125
Time used: 124.37660884857178
Time used: 124.46031498908997
Time used: 124.55246806144714
Time used: 124.64387202262878
Time used: 124.72652196884155
Time used: 124.80854296684265
Time used: 124.90957498550415
Time used: 124.993488073349
Time used: 125.07638788223267
Time used: 125.15991497039795
Time used: 125.243656873703
Time used: 125.32590103149414
Time used: 125.41002702713013
Time used: 125.50883793830872
Time used: 125.59321093559265
Time used: 125.675852060318
Time used: 125.7694890499115
Time used: 125.85922288894653
Time used: 125.94305491447449
Time used: 126.02581286430359
Time used: 126.11036801338196
Time used: 126.19298696517944
Time used: 126.2755708694458
Time used: 126.36813306808472
Time used: 126.45965600013733
Time used: 126.54322290420532
Time used: 126.62622785568237
Time used: 126.72598099708557
Time used: 126.80965900421143
Time used: 126.89304184913635
Time used: 126.9770860671997
Time used: 127.0603928565979
Time used: 127.14386987686157
Time used: 127.22670197486877
Time used: 127.309809923172
Time used: 127.39304304122925
Time used: 127.47568893432617
Time used: 127.56082797050476
Time used: 127.6602668762207
Time used: 127.74326801300049
Time used: 127.82665395736694
Time used: 127.90963006019592
Time used: 127.99272203445435
Time used: 128.0763909816742
Time used: 128.1586298942566
Time used: 128.26023292541504
Time used: 128.3435869216919
Time used: 128.4265558719635
Time used: 128.50946307182312
Time used: 128.5930199623108
Time used: 128.67693901062012
Time used: 128.76008796691895
Time used: 128.84423184394836
Time used: 128.92555904388428
Time used: 129.00957989692688
Time used: 129.10185384750366
Time used: 129.19221806526184
Time used: 129.2773220539093
Time used: 129.36091494560242
Time used: 129.45968890190125
Time used: 129.54189705848694
Time used: 129.6266589164734
Time used: 129.70875000953674
Time used: 129.7978479862213
Time used: 129.87665104866028
Time used: 129.95929789543152
Time used: 130.05878496170044
Time used: 130.1422209739685
Time used: 130.2253348827362
Time used: 130.3197569847107
Time used: 130.4087209701538
Time used: 130.49187898635864
Time used: 130.57637691497803
Time used: 130.6593930721283
Time used: 130.74256300926208
Time used: 130.82542085647583
Time used: 130.9193148612976
Time used: 131.00944805145264
Time used: 131.0925018787384
Time used: 131.17718505859375
Time used: 131.276202917099
Time used: 131.35994291305542
Time used: 131.44425296783447
Time used: 131.52669501304626
Time used: 131.61013197898865
Time used: 131.6932499408722
Time used: 131.77697491645813
Time used: 131.85929489135742
Time used: 131.9420518875122
Time used: 132.02562594413757
Time used: 132.11003994941711
Time used: 132.2108860015869
Time used: 132.29427099227905
Time used: 132.3754529953003
Time used: 132.46001601219177
Time used: 132.54317903518677
Time used: 132.6282708644867
Time used: 132.7095229625702
Time used: 132.80951499938965
Time used: 132.89332604408264
Time used: 132.9769048690796
Time used: 133.05888295173645
Time used: 133.1434998512268
Time used: 133.22746205329895
Time used: 133.30919289588928
Time used: 133.39320492744446
Time used: 133.47624492645264
Time used: 133.55880284309387
Time used: 133.65182399749756
Time used: 133.74296689033508
Time used: 133.82529497146606
Time used: 133.9102840423584
Time used: 134.00967407226562
Time used: 134.09225988388062
Time used: 134.1762239933014
Time used: 134.26029205322266
Time used: 134.34324884414673
Time used: 134.42595291137695
Time used: 134.51041388511658
Time used: 134.6088888645172
Time used: 134.69235587120056
Time used: 134.77694487571716
Time used: 134.8699028491974
Time used: 134.96090984344482
Time used: 135.04330587387085
Time used: 135.12554788589478
Time used: 135.20891690254211
Time used: 135.2930760383606
Time used: 135.37637090682983
Time used: 135.45922684669495
Time used: 135.5429618358612
Time used: 135.6266770362854
Time used: 135.71116995811462
Time used: 135.79276585578918
Time used: 135.87824487686157
Time used: 135.96066284179688
Time used: 136.04210090637207
Time used: 136.12676692008972
Time used: 136.20894193649292
Time used: 136.29401302337646
Time used: 136.38516306877136
Time used: 136.47712683677673
Time used: 136.5601680278778
Time used: 136.6434199810028
Time used: 136.74338388442993
Time used: 136.8263280391693
Time used: 136.91025805473328
Time used: 136.99375295639038
Time used: 137.0774929523468
Time used: 137.1606729030609
Time used: 137.24256801605225
Time used: 137.34242486953735
Time used: 137.42695903778076
Time used: 137.50957584381104
Time used: 137.60387706756592
Time used: 137.69303393363953
Time used: 137.7760419845581
Time used: 137.86002802848816
Time used: 137.9436378479004
Time used: 138.02759790420532
Time used: 138.11000394821167
Time used: 138.19270205497742
Time used: 138.27651286125183
Time used: 138.35912489891052
Time used: 138.4445140361786
Time used: 138.52632999420166
Time used: 138.61055898666382
Time used: 138.69424200057983
Time used: 138.77743005752563
Time used: 138.85996389389038
Time used: 138.94375705718994
Time used: 139.0269649028778
Time used: 139.11975598335266
Time used: 139.2089228630066
Time used: 139.29340386390686
Time used: 139.37709498405457
Time used: 139.4780080318451
Time used: 139.5591859817505
Time used: 139.6422040462494
Time used: 139.72715091705322
Time used: 139.8090159893036
Time used: 139.89287900924683
Time used: 139.9778869152069
Time used: 140.07677483558655
Time used: 140.16000199317932
Time used: 140.2436008453369
Time used: 140.33710098266602
Time used: 140.42689299583435
Time used: 140.5093958377838
Time used: 140.5934329032898
Time used: 140.67664003372192
Time used: 140.75943684577942
Time used: 140.84425806999207
Time used: 140.92606496810913
Time used: 141.00935292243958
Time used: 141.0925350189209
Time used: 141.17869400978088
Time used: 141.25936484336853
Time used: 141.3436598777771
Time used: 141.42636704444885
Time used: 141.5097939968109
Time used: 141.59374499320984
Time used: 141.67724585533142
Time used: 141.7606189250946
Time used: 141.85306787490845
Time used: 141.9437038898468
Time used: 142.0260660648346
Time used: 142.11062598228455
Time used: 142.20965695381165
Time used: 142.2934639453888
Time used: 142.37704706192017
Time used: 142.45921301841736
Time used: 142.54282188415527
Time used: 142.62702202796936
Time used: 142.70955896377563
Time used: 142.80987286567688
Time used: 142.89253997802734
Time used: 142.97748684883118
Time used: 143.0698058605194
Time used: 143.16038298606873
Time used: 143.2438268661499
Time used: 143.328204870224
Time used: 143.4092879295349
Time used: 143.4940390586853
Time used: 143.57728004455566
Time used: 143.66985297203064
Time used: 143.75953698158264
Time used: 143.84251403808594
Time used: 143.92669296264648
Time used: 144.02595400810242
Time used: 144.11062288284302
Time used: 144.19347596168518
Time used: 144.2772569656372
Time used: 144.36074805259705
Time used: 144.4432349205017
Time used: 144.5272879600525
Time used: 144.6281819343567
Time used: 144.71093606948853
Time used: 144.79405903816223
>>> random.sample(range(1000),20)
[579, 349, 613, 178, 851, 889, 71, 376, 870, 717, 404, 175, 262, 944, 707, 920, 5, 418, 670, 313]
>>>
>>>
>>> {x.strip() for x in (‘ he ‘,‘she ‘,‘ I‘)}
{‘I‘, ‘he‘, ‘she‘}
>>> x={random.randint(1,500) for i in range(100)}
>>> x
{8, 11, 12, 15, 16, 26, 30, 61, 63, 70, 73, 77, 80, 87, 96, 98, 111, 116, 119, 120, 124, 128, 129, 138, 139, 141, 142, 148, 149, 151, 161, 171, 178, 184, 195, 200, 203, 204, 205, 214, 221, 225, 230, 232, 233, 236, 238, 240, 246, 251, 252, 257, 258, 259, 261, 268, 270, 280, 281, 304, 320, 342, 343, 346, 348, 360, 366, 376, 377, 383, 385, 390, 396, 407, 409, 417, 424, 430, 440, 445, 448, 460, 461, 468, 472, 475, 477, 479, 492, 496, 500}
>>> len(x)
91
>>> {str(x) for x in range(10)}
{‘8‘, ‘9‘, ‘2‘, ‘4‘, ‘7‘, ‘0‘, ‘1‘, ‘5‘, ‘6‘, ‘3‘}
python_集合 list_5