content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
index = 0 def register(name, func): global index index += 1 func_name = name + str(index) globals()[func_name] = func return func_name
index = 0 def register(name, func): global index index += 1 func_name = name + str(index) globals()[func_name] = func return func_name
def search(data): string = "" number = "" last_i = "" for el in data: if el.isdigit(): number += el last_i = data.index(el) continue elif number == "": string += el else: break return string, number, last_i data = input() rage_msg = "" while not data == "": string, number, last_i = search(data) rage_msg += string.upper() * int(number) data = data[last_i + 1:] unique_sym = set(rage_msg) print(f"Unique symbols used: {len(unique_sym)}") print(rage_msg)
def search(data): string = '' number = '' last_i = '' for el in data: if el.isdigit(): number += el last_i = data.index(el) continue elif number == '': string += el else: break return (string, number, last_i) data = input() rage_msg = '' while not data == '': (string, number, last_i) = search(data) rage_msg += string.upper() * int(number) data = data[last_i + 1:] unique_sym = set(rage_msg) print(f'Unique symbols used: {len(unique_sym)}') print(rage_msg)
# -*- coding: utf-8 -*- ''' >>> from opem.Dynamic.Padulles_Hauer import * >>> import shutil >>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test3"} >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Hauer-Model Simulation ########### Analyzing . . . I : 0.1 E : 2.9234154992732004 V FC Efficiency : 0.41518043908246366 FC Power : 0.3238407424843217 W FC Voltage : 3.2384074248432166 V PH2 : 0.19717074233280188 atm PH2O : 0.2426831613626925 atm PO2 : 0.1906263686382979 atm Power-Thermal : 0.2911592575156784 W ########### I : 0.2 E : 2.9234139617015558 V FC Efficiency : 0.4108963136482338 FC Power : 0.6409982492912448 W FC Voltage : 3.204991246456224 V PH2 : 0.1971566919511875 atm PH2O : 0.24266586776736396 atm PO2 : 0.1906184358000996 atm Power-Thermal : 0.5890017507087553 W ########### I : 0.3 E : 2.9234124240659227 V FC Efficiency : 0.4083740564879825 FC Power : 0.955595292181879 W FC Voltage : 3.1853176406062635 V PH2 : 0.19714264156957312 atm PH2O : 0.24264857417203542 atm PO2 : 0.1906105029619013 atm Power-Thermal : 0.889404707818121 W ########### I : 0.4 E : 2.9234108863662946 V FC Efficiency : 0.4065731449109761 FC Power : 1.2685082121222457 W FC Voltage : 3.171270530305614 V PH2 : 0.19712859118795872 atm PH2O : 0.24263128057670688 atm PO2 : 0.19060257012370302 atm Power-Thermal : 1.1914917878777547 W ########### I : 0.5 E : 2.9234093486026658 V FC Efficiency : 0.4051674903968853 FC Power : 1.5801532125478528 W FC Voltage : 3.1603064250957056 V PH2 : 0.19711454080634436 atm PH2O : 0.24261398698137834 atm PO2 : 0.1905946372855047 atm Power-Thermal : 1.4948467874521474 W ########### I : 0.6 E : 2.923407810775032 V FC Efficiency : 0.4040118444230801 FC Power : 1.8907754319000147 W FC Voltage : 3.1512923865000246 V PH2 : 0.19710049042472996 atm PH2O : 0.2425966933860498 atm PO2 : 0.1905867044473064 atm Power-Thermal : 1.7992245680999854 W ########### I : 0.7 E : 2.923406272883388 V FC Efficiency : 0.4030287270042349 FC Power : 2.2005368494431226 W FC Voltage : 3.1436240706330323 V PH2 : 0.19708644004311557 atm PH2O : 0.24257939979072127 atm PO2 : 0.19057877160910808 atm Power-Thermal : 2.1044631505568776 W ########### I : 0.8 E : 2.9234047349277277 V FC Efficiency : 0.4021718894938075 FC Power : 2.509552590441359 W FC Voltage : 3.1369407380516985 V PH2 : 0.19707238966150117 atm PH2O : 0.24256210619539273 atm PO2 : 0.1905708387709098 atm Power-Thermal : 2.4104474095586417 W ########### I : 0.9 E : 2.9234031969080454 V FC Efficiency : 0.4014115005665013 FC Power : 2.81790873397684 W FC Voltage : 3.1310097044187106 V PH2 : 0.19705833927988675 atm PH2O : 0.24254481260006414 atm PO2 : 0.19056290593271147 atm Power-Thermal : 2.7170912660231608 W ########### I : 1.0 E : 2.9234016588243374 V FC Efficiency : 0.40072719160282416 FC Power : 3.1256720945020287 W FC Voltage : 3.1256720945020287 V PH2 : 0.19704428889827239 atm PH2O : 0.2425275190047356 atm PO2 : 0.1905549730945132 atm Power-Thermal : 3.0243279054979717 W ########### I : 1.1 E : 2.9234001206765963 V FC Efficiency : 0.40010443449551725 FC Power : 3.4328960479715387 W FC Voltage : 3.1208145890650347 V PH2 : 0.197030238516658 atm PH2O : 0.24251022540940706 atm PO2 : 0.19054704025631486 atm Power-Thermal : 3.3321039520284623 W ########### I : 1.2 E : 2.9233985824648183 V FC Efficiency : 0.39953250222749515 FC Power : 3.7396242208493544 W FC Voltage : 3.116353517374462 V PH2 : 0.1970161881350436 atm PH2O : 0.24249293181407852 atm PO2 : 0.19053910741811658 atm Power-Thermal : 3.640375779150646 W ########### I : 1.3 E : 2.923397044188998 V FC Efficiency : 0.3990032485837277 FC Power : 4.045892940639 W FC Voltage : 3.1122253389530767 V PH2 : 0.19700213775342923 atm PH2O : 0.24247563821874998 atm PO2 : 0.19053117457991825 atm Power-Thermal : 3.9491070593610007 W ########### I : 1.4 E : 2.923395505849129 V FC Efficiency : 0.3985103413824903 FC Power : 4.351732927896794 W FC Voltage : 3.1083806627834245 V PH2 : 0.19698808737181484 atm PH2O : 0.24245834462342142 atm PO2 : 0.19052324174171997 atm Power-Thermal : 4.258267072103206 W ########### I : 1.5 E : 2.923393967445207 V FC Efficiency : 0.3980487608857143 FC Power : 4.657170502362857 W FC Voltage : 3.1047803349085714 V PH2 : 0.19697403699020044 atm PH2O : 0.24244105102809288 atm PO2 : 0.19051530890352164 atm Power-Thermal : 4.567829497637144 W ########### I : 1.6 E : 2.923392428977226 V FC Efficiency : 0.39761446042126253 FC Power : 4.962228466057358 W FC Voltage : 3.101392791285848 V PH2 : 0.19695998660858605 atm PH2O : 0.24242375743276434 atm PO2 : 0.19050737606532336 atm Power-Thermal : 4.877771533942644 W ########### I : 1.7 E : 2.9233908904451815 V FC Efficiency : 0.3972041300730298 FC Power : 5.2669267647683755 W FC Voltage : 3.098192214569633 V PH2 : 0.19694593622697168 atm PH2O : 0.2424064638374358 atm PO2 : 0.19049944322712503 atm Power-Thermal : 5.188073235231625 W ########### I : 1.8 E : 2.9233893518490675 V FC Efficiency : 0.39681502801851076 FC Power : 5.571282993379892 W FC Voltage : 3.0951572185443843 V PH2 : 0.19693188584535729 atm PH2O : 0.24238917024210727 atm PO2 : 0.19049151038892673 atm Power-Thermal : 5.498717006620109 W ########### I : 1.9 E : 2.9233878131888784 V FC Efficiency : 0.3964448575287326 FC Power : 5.875312788575817 W FC Voltage : 3.0922698887241142 V PH2 : 0.1969178354637429 atm PH2O : 0.24237187664677873 atm PO2 : 0.19048357755072845 atm Power-Thermal : 5.809687211424183 W ########### I : 2.0 E : 2.9233862744646095 V FC Efficiency : 0.3960916755547374 FC Power : 6.1790301386539035 W FC Voltage : 3.0895150693269517 V PH2 : 0.19690378508212852 atm PH2O : 0.2423545830514502 atm PO2 : 0.19047564471253012 atm Power-Thermal : 6.120969861346097 W ########### I : 2.1 E : 2.923384735676255 V FC Efficiency : 0.39575382364054146 FC Power : 6.482447631232071 W FC Voltage : 3.086879824396224 V PH2 : 0.19688973470051413 atm PH2O : 0.24233728945612165 atm PO2 : 0.19046771187433184 atm Power-Thermal : 6.432552368767931 W ########### I : 2.2 E : 2.92338319682381 V FC Efficiency : 0.3954298749226794 FC Power : 6.78557665367318 W FC Voltage : 3.0843530243968997 V PH2 : 0.19687568431889974 atm PH2O : 0.2423199958607931 atm PO2 : 0.1904597790361335 atm Power-Thermal : 6.744423346326822 W ########### I : 2.3 E : 2.923381657907269 V FC Efficiency : 0.39511859292081414 FC Power : 7.088427556999405 W FC Voltage : 3.0819250247823504 V PH2 : 0.19686163393728537 atm PH2O : 0.24230270226546458 atm PO2 : 0.19045184619793523 atm Power-Thermal : 7.0565724430005945 W ########### I : 2.4 E : 2.9233801189266266 V FC Efficiency : 0.39481889910524637 FC Power : 7.391009791250212 W FC Voltage : 3.079587413020922 V PH2 : 0.19684758355567097 atm PH2O : 0.242285408670136 atm PO2 : 0.1904439133597369 atm Power-Thermal : 7.368990208749787 W ########### I : 2.5 E : 2.923378579881877 V FC Efficiency : 0.39452984708947947 FC Power : 7.693332018244849 W FC Voltage : 3.07733280729794 V PH2 : 0.19683353317405658 atm PH2O : 0.24226811507480747 atm PO2 : 0.19043598052153862 atm Power-Thermal : 7.681667981755151 W ########### I : 2.6 E : 2.923377040773016 V FC Efficiency : 0.39425060188740335 FC Power : 7.995402206276542 W FC Voltage : 3.0751546947217467 V PH2 : 0.19681948279244216 atm PH2O : 0.2422508214794789 atm PO2 : 0.1904280476833403 atm Power-Thermal : 7.99459779372346 W ########### I : 2.7 E : 2.923375501600037 V FC Efficiency : 0.3939804230873111 FC Power : 8.297227710218774 W FC Voltage : 3.073047300081027 V PH2 : 0.19680543241082776 atm PH2O : 0.24223352788415034 atm PO2 : 0.190420114845142 atm Power-Thermal : 8.307772289781228 W ########### I : 2.8 E : 2.923373962362936 V FC Efficiency : 0.3937186510874208 FC Power : 8.59881533974927 W FC Voltage : 3.0710054784818825 V PH2 : 0.1967913820292134 atm PH2O : 0.2422162342888218 atm PO2 : 0.19041218200694368 atm Power-Thermal : 8.62118466025073 W ########### I : 2.9 E : 2.9233724230617057 V FC Efficiency : 0.3934646957478549 FC Power : 8.900171417816479 W FC Voltage : 3.0690246268332686 V PH2 : 0.196777331647599 atm PH2O : 0.24219894069349326 atm PO2 : 0.1904042491687454 atm Power-Thermal : 8.934828582183522 W ########### I : 3.0 E : 2.923370883696343 V FC Efficiency : 0.39321802696722546 FC Power : 9.201301831033076 W FC Voltage : 3.0671006103443585 V PH2 : 0.1967632812659846 atm PH2O : 0.24218164709816473 atm PO2 : 0.19039631633054707 atm Power-Thermal : 9.248698168966925 W ########### I : 3.1 E : 2.9233693442668414 V FC Efficiency : 0.39297816680494896 FC Power : 9.502212073343667 W FC Voltage : 3.0652297010786023 V PH2 : 0.19674923088437024 atm PH2O : 0.2421643535028362 atm PO2 : 0.1903883834923488 atm Power-Thermal : 9.562787926656334 W ########### I : 3.2 E : 2.9233678047731946 V FC Efficiency : 0.39274468285467545 FC Power : 9.8029072840527 W FC Voltage : 3.0634085262664685 V PH2 : 0.19673518050275585 atm PH2O : 0.24214705990750765 atm PO2 : 0.19038045065415046 atm Power-Thermal : 9.877092715947303 W ########### I : 3.3 E : 2.9233662652153996 V FC Efficiency : 0.3925171826377131 FC Power : 10.103392281094736 W FC Voltage : 3.0616340245741624 V PH2 : 0.19672113012114145 atm PH2O : 0.2421297663121791 atm PO2 : 0.19037251781595219 atm Power-Thermal : 10.191607718905265 W ########### I : 3.4 E : 2.923364725593449 V FC Efficiency : 0.39229530883366054 FC Power : 10.403671590268678 W FC Voltage : 3.059903408902552 V PH2 : 0.19670707973952706 atm PH2O : 0.24211247271685057 atm PO2 : 0.19036458497775385 atm Power-Thermal : 10.506328409731324 W ########### I : 3.5 E : 2.923363185907339 V FC Efficiency : 0.39207873520256487 FC Power : 10.703749471030022 W FC Voltage : 3.0582141345800062 V PH2 : 0.1966930293579127 atm PH2O : 0.24209517912152204 atm PO2 : 0.19035665213955555 atm Power-Thermal : 10.82125052896998 W ########### I : 3.6 E : 2.923361646157063 V FC Efficiency : 0.3918671630816706 FC Power : 11.003629939333312 W FC Voltage : 3.0565638720370307 V PH2 : 0.1966789789762983 atm PH2O : 0.2420778855261935 atm PO2 : 0.19034871930135727 atm Power-Thermal : 11.13637006066669 W ########### I : 3.7 E : 2.923360106342616 V FC Efficiency : 0.3916603183622587 FC Power : 11.303316787934786 W FC Voltage : 3.054950483225618 V PH2 : 0.1966649285946839 atm PH2O : 0.24206059193086493 atm PO2 : 0.19034078646315894 atm Power-Thermal : 11.451683212065214 W ########### I : 3.8 E : 2.9233585664639925 V FC Efficiency : 0.3914579488697281 FC Power : 11.602813604498742 W FC Voltage : 3.0533720011838796 V PH2 : 0.19665087821306954 atm PH2O : 0.2420432983355364 atm PO2 : 0.19033285362496066 atm Power-Thermal : 11.767186395501259 W ########### I : 3.9 E : 2.9233570265211877 V FC Efficiency : 0.3912598220840501 FC Power : 11.902123787796803 W FC Voltage : 3.051826612255591 V PH2 : 0.19663682783145514 atm PH2O : 0.24202600474020786 atm PO2 : 0.19032492078676233 atm Power-Thermal : 12.082876212203196 W ########### Report is generating ... Done! >>> Padulles_Hauer_Data["Status"] True >>> Padulles_Hauer_Data["P"][5] 1.8907754319000147 >>> Padulles_Hauer_Data["I"][5] 0.6 >>> Padulles_Hauer_Data["V"][5] 3.1512923865000246 >>> Padulles_Hauer_Data["EFF"][5] 0.4040118444230801 >>> Padulles_Hauer_Data["PO2"][5] 0.1905867044473064 >>> Padulles_Hauer_Data["PH2"][5] 0.19710049042472996 >>> Padulles_Hauer_Data["PH2O"][5] 0.2425966933860498 >>> Padulles_Hauer_Data["Ph"][5] 1.7992245680999854 >>> Padulles_Hauer_Data["V0"] 3.1748727715256186 >>> Padulles_Hauer_Data["K"] -0.03643090556526363 >>> Padulles_Hauer_Data["VE"][5] 3.1530142281864606 >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod={}, TestMode=True,PrintMode=False) >>> Padulles_Hauer_Data["Status"] False >>> qH2_Calc(qMethanol=None,CV=2,t1=2,t2=2) [Error] qH2 Calculation Failed (qMethanol:None, CV:2, t1:2, t2:2) >>> Test_Vector={"T":2,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test3"} >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Hauer-Model Simulation ########### Analyzing . . . I : 0.1 E : -3.00044655685555 V FC Efficiency : -0.3442890552930171 FC Power : -0.2685454631285534 W FC Voltage : -2.6854546312855336 V PH2 : 0.19717074233280188 atm PH2O : 0.2426831613626925 atm PO2 : 0.1906263686382979 atm Power-Thermal : 0.8835454631285535 W ########### I : 2.0 E : -3.000446727262597 V FC Efficiency : -0.3633740938974685 FC Power : -5.6686358648005095 W FC Voltage : -2.8343179324002548 V PH2 : 0.19690378508212852 atm PH2O : 0.2423545830514502 atm PO2 : 0.19047564471253012 atm Power-Thermal : 17.96863586480051 W ########### Report is generating ... Warning : The value of I(>0.1) leads to minus amount of V, please check your inputs Done! >>> shutil.rmtree("Padulles-Hauer") '''
""" >>> from opem.Dynamic.Padulles_Hauer import * >>> import shutil >>> Test_Vector={"T":343,"E0":0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0.1,"i-stop":4,"i-step":0.1,"Name":"test3"} >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Hauer-Model Simulation ########### Analyzing . . . I : 0.1 E : 2.9234154992732004 V FC Efficiency : 0.41518043908246366 FC Power : 0.3238407424843217 W FC Voltage : 3.2384074248432166 V PH2 : 0.19717074233280188 atm PH2O : 0.2426831613626925 atm PO2 : 0.1906263686382979 atm Power-Thermal : 0.2911592575156784 W ########### I : 0.2 E : 2.9234139617015558 V FC Efficiency : 0.4108963136482338 FC Power : 0.6409982492912448 W FC Voltage : 3.204991246456224 V PH2 : 0.1971566919511875 atm PH2O : 0.24266586776736396 atm PO2 : 0.1906184358000996 atm Power-Thermal : 0.5890017507087553 W ########### I : 0.3 E : 2.9234124240659227 V FC Efficiency : 0.4083740564879825 FC Power : 0.955595292181879 W FC Voltage : 3.1853176406062635 V PH2 : 0.19714264156957312 atm PH2O : 0.24264857417203542 atm PO2 : 0.1906105029619013 atm Power-Thermal : 0.889404707818121 W ########### I : 0.4 E : 2.9234108863662946 V FC Efficiency : 0.4065731449109761 FC Power : 1.2685082121222457 W FC Voltage : 3.171270530305614 V PH2 : 0.19712859118795872 atm PH2O : 0.24263128057670688 atm PO2 : 0.19060257012370302 atm Power-Thermal : 1.1914917878777547 W ########### I : 0.5 E : 2.9234093486026658 V FC Efficiency : 0.4051674903968853 FC Power : 1.5801532125478528 W FC Voltage : 3.1603064250957056 V PH2 : 0.19711454080634436 atm PH2O : 0.24261398698137834 atm PO2 : 0.1905946372855047 atm Power-Thermal : 1.4948467874521474 W ########### I : 0.6 E : 2.923407810775032 V FC Efficiency : 0.4040118444230801 FC Power : 1.8907754319000147 W FC Voltage : 3.1512923865000246 V PH2 : 0.19710049042472996 atm PH2O : 0.2425966933860498 atm PO2 : 0.1905867044473064 atm Power-Thermal : 1.7992245680999854 W ########### I : 0.7 E : 2.923406272883388 V FC Efficiency : 0.4030287270042349 FC Power : 2.2005368494431226 W FC Voltage : 3.1436240706330323 V PH2 : 0.19708644004311557 atm PH2O : 0.24257939979072127 atm PO2 : 0.19057877160910808 atm Power-Thermal : 2.1044631505568776 W ########### I : 0.8 E : 2.9234047349277277 V FC Efficiency : 0.4021718894938075 FC Power : 2.509552590441359 W FC Voltage : 3.1369407380516985 V PH2 : 0.19707238966150117 atm PH2O : 0.24256210619539273 atm PO2 : 0.1905708387709098 atm Power-Thermal : 2.4104474095586417 W ########### I : 0.9 E : 2.9234031969080454 V FC Efficiency : 0.4014115005665013 FC Power : 2.81790873397684 W FC Voltage : 3.1310097044187106 V PH2 : 0.19705833927988675 atm PH2O : 0.24254481260006414 atm PO2 : 0.19056290593271147 atm Power-Thermal : 2.7170912660231608 W ########### I : 1.0 E : 2.9234016588243374 V FC Efficiency : 0.40072719160282416 FC Power : 3.1256720945020287 W FC Voltage : 3.1256720945020287 V PH2 : 0.19704428889827239 atm PH2O : 0.2425275190047356 atm PO2 : 0.1905549730945132 atm Power-Thermal : 3.0243279054979717 W ########### I : 1.1 E : 2.9234001206765963 V FC Efficiency : 0.40010443449551725 FC Power : 3.4328960479715387 W FC Voltage : 3.1208145890650347 V PH2 : 0.197030238516658 atm PH2O : 0.24251022540940706 atm PO2 : 0.19054704025631486 atm Power-Thermal : 3.3321039520284623 W ########### I : 1.2 E : 2.9233985824648183 V FC Efficiency : 0.39953250222749515 FC Power : 3.7396242208493544 W FC Voltage : 3.116353517374462 V PH2 : 0.1970161881350436 atm PH2O : 0.24249293181407852 atm PO2 : 0.19053910741811658 atm Power-Thermal : 3.640375779150646 W ########### I : 1.3 E : 2.923397044188998 V FC Efficiency : 0.3990032485837277 FC Power : 4.045892940639 W FC Voltage : 3.1122253389530767 V PH2 : 0.19700213775342923 atm PH2O : 0.24247563821874998 atm PO2 : 0.19053117457991825 atm Power-Thermal : 3.9491070593610007 W ########### I : 1.4 E : 2.923395505849129 V FC Efficiency : 0.3985103413824903 FC Power : 4.351732927896794 W FC Voltage : 3.1083806627834245 V PH2 : 0.19698808737181484 atm PH2O : 0.24245834462342142 atm PO2 : 0.19052324174171997 atm Power-Thermal : 4.258267072103206 W ########### I : 1.5 E : 2.923393967445207 V FC Efficiency : 0.3980487608857143 FC Power : 4.657170502362857 W FC Voltage : 3.1047803349085714 V PH2 : 0.19697403699020044 atm PH2O : 0.24244105102809288 atm PO2 : 0.19051530890352164 atm Power-Thermal : 4.567829497637144 W ########### I : 1.6 E : 2.923392428977226 V FC Efficiency : 0.39761446042126253 FC Power : 4.962228466057358 W FC Voltage : 3.101392791285848 V PH2 : 0.19695998660858605 atm PH2O : 0.24242375743276434 atm PO2 : 0.19050737606532336 atm Power-Thermal : 4.877771533942644 W ########### I : 1.7 E : 2.9233908904451815 V FC Efficiency : 0.3972041300730298 FC Power : 5.2669267647683755 W FC Voltage : 3.098192214569633 V PH2 : 0.19694593622697168 atm PH2O : 0.2424064638374358 atm PO2 : 0.19049944322712503 atm Power-Thermal : 5.188073235231625 W ########### I : 1.8 E : 2.9233893518490675 V FC Efficiency : 0.39681502801851076 FC Power : 5.571282993379892 W FC Voltage : 3.0951572185443843 V PH2 : 0.19693188584535729 atm PH2O : 0.24238917024210727 atm PO2 : 0.19049151038892673 atm Power-Thermal : 5.498717006620109 W ########### I : 1.9 E : 2.9233878131888784 V FC Efficiency : 0.3964448575287326 FC Power : 5.875312788575817 W FC Voltage : 3.0922698887241142 V PH2 : 0.1969178354637429 atm PH2O : 0.24237187664677873 atm PO2 : 0.19048357755072845 atm Power-Thermal : 5.809687211424183 W ########### I : 2.0 E : 2.9233862744646095 V FC Efficiency : 0.3960916755547374 FC Power : 6.1790301386539035 W FC Voltage : 3.0895150693269517 V PH2 : 0.19690378508212852 atm PH2O : 0.2423545830514502 atm PO2 : 0.19047564471253012 atm Power-Thermal : 6.120969861346097 W ########### I : 2.1 E : 2.923384735676255 V FC Efficiency : 0.39575382364054146 FC Power : 6.482447631232071 W FC Voltage : 3.086879824396224 V PH2 : 0.19688973470051413 atm PH2O : 0.24233728945612165 atm PO2 : 0.19046771187433184 atm Power-Thermal : 6.432552368767931 W ########### I : 2.2 E : 2.92338319682381 V FC Efficiency : 0.3954298749226794 FC Power : 6.78557665367318 W FC Voltage : 3.0843530243968997 V PH2 : 0.19687568431889974 atm PH2O : 0.2423199958607931 atm PO2 : 0.1904597790361335 atm Power-Thermal : 6.744423346326822 W ########### I : 2.3 E : 2.923381657907269 V FC Efficiency : 0.39511859292081414 FC Power : 7.088427556999405 W FC Voltage : 3.0819250247823504 V PH2 : 0.19686163393728537 atm PH2O : 0.24230270226546458 atm PO2 : 0.19045184619793523 atm Power-Thermal : 7.0565724430005945 W ########### I : 2.4 E : 2.9233801189266266 V FC Efficiency : 0.39481889910524637 FC Power : 7.391009791250212 W FC Voltage : 3.079587413020922 V PH2 : 0.19684758355567097 atm PH2O : 0.242285408670136 atm PO2 : 0.1904439133597369 atm Power-Thermal : 7.368990208749787 W ########### I : 2.5 E : 2.923378579881877 V FC Efficiency : 0.39452984708947947 FC Power : 7.693332018244849 W FC Voltage : 3.07733280729794 V PH2 : 0.19683353317405658 atm PH2O : 0.24226811507480747 atm PO2 : 0.19043598052153862 atm Power-Thermal : 7.681667981755151 W ########### I : 2.6 E : 2.923377040773016 V FC Efficiency : 0.39425060188740335 FC Power : 7.995402206276542 W FC Voltage : 3.0751546947217467 V PH2 : 0.19681948279244216 atm PH2O : 0.2422508214794789 atm PO2 : 0.1904280476833403 atm Power-Thermal : 7.99459779372346 W ########### I : 2.7 E : 2.923375501600037 V FC Efficiency : 0.3939804230873111 FC Power : 8.297227710218774 W FC Voltage : 3.073047300081027 V PH2 : 0.19680543241082776 atm PH2O : 0.24223352788415034 atm PO2 : 0.190420114845142 atm Power-Thermal : 8.307772289781228 W ########### I : 2.8 E : 2.923373962362936 V FC Efficiency : 0.3937186510874208 FC Power : 8.59881533974927 W FC Voltage : 3.0710054784818825 V PH2 : 0.1967913820292134 atm PH2O : 0.2422162342888218 atm PO2 : 0.19041218200694368 atm Power-Thermal : 8.62118466025073 W ########### I : 2.9 E : 2.9233724230617057 V FC Efficiency : 0.3934646957478549 FC Power : 8.900171417816479 W FC Voltage : 3.0690246268332686 V PH2 : 0.196777331647599 atm PH2O : 0.24219894069349326 atm PO2 : 0.1904042491687454 atm Power-Thermal : 8.934828582183522 W ########### I : 3.0 E : 2.923370883696343 V FC Efficiency : 0.39321802696722546 FC Power : 9.201301831033076 W FC Voltage : 3.0671006103443585 V PH2 : 0.1967632812659846 atm PH2O : 0.24218164709816473 atm PO2 : 0.19039631633054707 atm Power-Thermal : 9.248698168966925 W ########### I : 3.1 E : 2.9233693442668414 V FC Efficiency : 0.39297816680494896 FC Power : 9.502212073343667 W FC Voltage : 3.0652297010786023 V PH2 : 0.19674923088437024 atm PH2O : 0.2421643535028362 atm PO2 : 0.1903883834923488 atm Power-Thermal : 9.562787926656334 W ########### I : 3.2 E : 2.9233678047731946 V FC Efficiency : 0.39274468285467545 FC Power : 9.8029072840527 W FC Voltage : 3.0634085262664685 V PH2 : 0.19673518050275585 atm PH2O : 0.24214705990750765 atm PO2 : 0.19038045065415046 atm Power-Thermal : 9.877092715947303 W ########### I : 3.3 E : 2.9233662652153996 V FC Efficiency : 0.3925171826377131 FC Power : 10.103392281094736 W FC Voltage : 3.0616340245741624 V PH2 : 0.19672113012114145 atm PH2O : 0.2421297663121791 atm PO2 : 0.19037251781595219 atm Power-Thermal : 10.191607718905265 W ########### I : 3.4 E : 2.923364725593449 V FC Efficiency : 0.39229530883366054 FC Power : 10.403671590268678 W FC Voltage : 3.059903408902552 V PH2 : 0.19670707973952706 atm PH2O : 0.24211247271685057 atm PO2 : 0.19036458497775385 atm Power-Thermal : 10.506328409731324 W ########### I : 3.5 E : 2.923363185907339 V FC Efficiency : 0.39207873520256487 FC Power : 10.703749471030022 W FC Voltage : 3.0582141345800062 V PH2 : 0.1966930293579127 atm PH2O : 0.24209517912152204 atm PO2 : 0.19035665213955555 atm Power-Thermal : 10.82125052896998 W ########### I : 3.6 E : 2.923361646157063 V FC Efficiency : 0.3918671630816706 FC Power : 11.003629939333312 W FC Voltage : 3.0565638720370307 V PH2 : 0.1966789789762983 atm PH2O : 0.2420778855261935 atm PO2 : 0.19034871930135727 atm Power-Thermal : 11.13637006066669 W ########### I : 3.7 E : 2.923360106342616 V FC Efficiency : 0.3916603183622587 FC Power : 11.303316787934786 W FC Voltage : 3.054950483225618 V PH2 : 0.1966649285946839 atm PH2O : 0.24206059193086493 atm PO2 : 0.19034078646315894 atm Power-Thermal : 11.451683212065214 W ########### I : 3.8 E : 2.9233585664639925 V FC Efficiency : 0.3914579488697281 FC Power : 11.602813604498742 W FC Voltage : 3.0533720011838796 V PH2 : 0.19665087821306954 atm PH2O : 0.2420432983355364 atm PO2 : 0.19033285362496066 atm Power-Thermal : 11.767186395501259 W ########### I : 3.9 E : 2.9233570265211877 V FC Efficiency : 0.3912598220840501 FC Power : 11.902123787796803 W FC Voltage : 3.051826612255591 V PH2 : 0.19663682783145514 atm PH2O : 0.24202600474020786 atm PO2 : 0.19032492078676233 atm Power-Thermal : 12.082876212203196 W ########### Report is generating ... Done! >>> Padulles_Hauer_Data["Status"] True >>> Padulles_Hauer_Data["P"][5] 1.8907754319000147 >>> Padulles_Hauer_Data["I"][5] 0.6 >>> Padulles_Hauer_Data["V"][5] 3.1512923865000246 >>> Padulles_Hauer_Data["EFF"][5] 0.4040118444230801 >>> Padulles_Hauer_Data["PO2"][5] 0.1905867044473064 >>> Padulles_Hauer_Data["PH2"][5] 0.19710049042472996 >>> Padulles_Hauer_Data["PH2O"][5] 0.2425966933860498 >>> Padulles_Hauer_Data["Ph"][5] 1.7992245680999854 >>> Padulles_Hauer_Data["V0"] 3.1748727715256186 >>> Padulles_Hauer_Data["K"] -0.03643090556526363 >>> Padulles_Hauer_Data["VE"][5] 3.1530142281864606 >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod={}, TestMode=True,PrintMode=False) >>> Padulles_Hauer_Data["Status"] False >>> qH2_Calc(qMethanol=None,CV=2,t1=2,t2=2) [Error] qH2 Calculation Failed (qMethanol:None, CV:2, t1:2, t2:2) >>> Test_Vector={"T":2,"E0":-0.6,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"B":0.04777,"C":0.0136,"Rint":0.00303,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":4,"i-stop":0.1,"i-step":-2,"Name":"test3"} >>> Padulles_Hauer_Data=Dynamic_Analysis(InputMethod=Test_Vector, TestMode=True) ########### Padulles-Hauer-Model Simulation ########### Analyzing . . . I : 0.1 E : -3.00044655685555 V FC Efficiency : -0.3442890552930171 FC Power : -0.2685454631285534 W FC Voltage : -2.6854546312855336 V PH2 : 0.19717074233280188 atm PH2O : 0.2426831613626925 atm PO2 : 0.1906263686382979 atm Power-Thermal : 0.8835454631285535 W ########### I : 2.0 E : -3.000446727262597 V FC Efficiency : -0.3633740938974685 FC Power : -5.6686358648005095 W FC Voltage : -2.8343179324002548 V PH2 : 0.19690378508212852 atm PH2O : 0.2423545830514502 atm PO2 : 0.19047564471253012 atm Power-Thermal : 17.96863586480051 W ########### Report is generating ... Warning : The value of I(>0.1) leads to minus amount of V, please check your inputs Done! >>> shutil.rmtree("Padulles-Hauer") """
bag = dict() bag["mathTextBook"] = 12.5 bag["nameTag"] = "Winston" bag.update({"nameTag": "Grace"}) print(bag)
bag = dict() bag['mathTextBook'] = 12.5 bag['nameTag'] = 'Winston' bag.update({'nameTag': 'Grace'}) print(bag)
M = 10**9 + 7 def solve(n): a = n i = 1 while i < n: k = n // i j = min(n // k + 1, n) a += k * (j - i) * n - k * (k + 1) * (j - i) * (i + j - 1) // 4 a %= M i = j return a for _ in range(int(input())): n = int(input()) print(solve(n))
m = 10 ** 9 + 7 def solve(n): a = n i = 1 while i < n: k = n // i j = min(n // k + 1, n) a += k * (j - i) * n - k * (k + 1) * (j - i) * (i + j - 1) // 4 a %= M i = j return a for _ in range(int(input())): n = int(input()) print(solve(n))
string = input('enter string from which vowels are need to be remove ') string = string.lower() vowels = ('a','e','i','o','u') for c in string: if string in vowels: new_str = string.replace(c,'') print(new_str)
string = input('enter string from which vowels are need to be remove ') string = string.lower() vowels = ('a', 'e', 'i', 'o', 'u') for c in string: if string in vowels: new_str = string.replace(c, '') print(new_str)
# # PySNMP MIB module EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:56:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint") fastPath, = mibBuilder.importSymbols("EdgeSwitch-REF-MIB", "fastPath") dot1xPaePortNumber, = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "dot1xPaePortNumber") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") ModuleIdentity, iso, IpAddress, Integer32, Counter64, ObjectIdentity, NotificationType, Bits, Counter32, Gauge32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "iso", "IpAddress", "Integer32", "Counter64", "ObjectIdentity", "NotificationType", "Bits", "Counter32", "Gauge32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "TimeTicks") DateAndTime, TextualConvention, RowStatus, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "DateAndTime", "TextualConvention", "RowStatus", "MacAddress", "DisplayString") fastPathdot1xAdvanced = ModuleIdentity((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36)) fastPathdot1xAdvanced.setRevisions(('2011-01-26 00:00', '2007-05-23 00:00',)) if mibBuilder.loadTexts: fastPathdot1xAdvanced.setLastUpdated('201101260000Z') if mibBuilder.loadTexts: fastPathdot1xAdvanced.setOrganization('Broadcom Inc') class Dot1xPortControlMode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4)) namedValues = NamedValues(("forceUnauthorized", 1), ("auto", 2), ("forceAuthorized", 3), ("macBased", 4)) class Dot1xSessionTerminationAction(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("default", 1), ("reauthenticate", 2)) agentDot1xEnhancementConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1)) agentDot1xRadiusVlanAssignment = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xRadiusVlanAssignment.setStatus('current') agentDot1xDynamicVlanCreationMode = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xDynamicVlanCreationMode.setStatus('current') agentDot1xEapolFloodMode = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xEapolFloodMode.setStatus('current') agentDot1xPortConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2)) agentDot1xPortConfigTable = MibTable((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1), ) if mibBuilder.loadTexts: agentDot1xPortConfigTable.setStatus('current') agentDot1xPortConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber")) if mibBuilder.loadTexts: agentDot1xPortConfigEntry.setStatus('current') agentDot1xPortControlMode = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 1), Dot1xPortControlMode().clone('auto')).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xPortControlMode.setStatus('current') agentDot1xGuestVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 2), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xGuestVlanId.setStatus('current') agentDot1xGuestVlanPeriod = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 300)).clone(90)).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xGuestVlanPeriod.setStatus('current') agentDot1xUnauthenticatedVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 4), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xUnauthenticatedVlan.setStatus('current') agentDot1xMaxUsers = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 5), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xMaxUsers.setStatus('current') agentDot1xPortVlanAssigned = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 6), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xPortVlanAssigned.setStatus('current') agentDot1xPortVlanAssignedReason = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("default", 1), ("radius", 2), ("unauthenticatedVlan", 3), ("guestVlan", 4), ("voiceVlan", 5), ("monitorVlan", 6), ("notAssigned", 7))).clone(5)).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xPortVlanAssignedReason.setStatus('current') agentDot1xPortSessionTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 8), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xPortSessionTimeout.setStatus('current') agentDot1xPortTerminationAction = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 9), Dot1xSessionTerminationAction().clone(1)).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xPortTerminationAction.setStatus('current') agentDot1xPortMABenabled = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xPortMABenabled.setStatus('current') agentDot1xPortMABenabledOperational = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xPortMABenabledOperational.setStatus('current') agentDot1xClientConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3)) agentDot1xClientConfigTable = MibTable((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1), ) if mibBuilder.loadTexts: agentDot1xClientConfigTable.setStatus('current') agentDot1xClientConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1), ).setIndexNames((0, "EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB", "agentDot1xClientMacAddress")) if mibBuilder.loadTexts: agentDot1xClientConfigEntry.setStatus('current') agentDot1xClientMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 1), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientMacAddress.setStatus('current') agentDot1xLogicalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xLogicalPort.setStatus('current') agentDot1xInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xInterface.setStatus('current') agentDot1xClientAuthPAEstate = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("initialize", 1), ("disconnected", 2), ("connecting", 3), ("authenticating", 4), ("authenticated", 5), ("aborting", 6), ("held", 7), ("forceAuth", 8), ("forceUnauth", 9)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientAuthPAEstate.setStatus('current') agentDot1xClientBackendState = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("request", 1), ("response", 2), ("success", 3), ("fail", 4), ("timeout", 5), ("idle", 6), ("initialize", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientBackendState.setStatus('current') agentDot1xClientUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientUserName.setStatus('current') agentDot1xClientSessionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 7), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientSessionTime.setStatus('current') agentDot1xClientFilterID = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientFilterID.setStatus('current') agentDot1xClientVlanAssigned = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 9), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientVlanAssigned.setStatus('current') agentDot1xClientVlanAssignedReason = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 6, 7))).clone(namedValues=NamedValues(("default", 1), ("radius", 2), ("unauthenticatedVlan", 3), ("monitorVlan", 6), ("invalid", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientVlanAssignedReason.setStatus('current') agentDot1xClientSessionTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 11), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientSessionTimeout.setStatus('current') agentDot1xClientTerminationAction = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 12), Dot1xSessionTerminationAction()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xClientTerminationAction.setStatus('current') agentDot1xMonitorModeConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4)) agentDot1xMonitorModeEnabled = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xMonitorModeEnabled.setStatus('current') agentDot1xMonitorModeClients = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xMonitorModeClients.setStatus('current') agentDot1xNonMonitorModeClients = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xNonMonitorModeClients.setStatus('current') agentDot1xAuthHistoryResultsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5)) agentDot1xPortAuthHistoryResultTable = MibTable((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1), ) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultTable.setStatus('current') agentDot1xPortAuthHistoryResultEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1), ).setIndexNames((0, "EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB", "agentDot1xAuthHistoryResultIfaceIndex"), (0, "EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB", "agentDot1xAuthHistoryResultIndex")) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultEntry.setStatus('current') agentDot1xAuthHistoryResultIfaceIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultIfaceIndex.setStatus('current') agentDot1xAuthHistoryResultIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultIndex.setStatus('current') agentDot1xAuthHistoryResultTimeStamp = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 3), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultTimeStamp.setStatus('current') agentDot1xAuthHistoryResultAge = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultAge.setStatus('current') agentDot1xAuthHistoryResultMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 5), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultMacAddress.setStatus('current') agentDot1xAuthHistoryResultVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 6), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultVlanId.setStatus('current') agentDot1xAuthHistoryResultAuthStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("success", 1), ("failure", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultAuthStatus.setStatus('current') agentDot1xAuthHistoryResultAccessStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("granted", 1), ("denied", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultAccessStatus.setStatus('current') agentDot1xAuthHistoryResultFilterID = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultFilterID.setStatus('current') agentDot1xAuthHistoryResultVlanAssigned = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 10), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultVlanAssigned.setStatus('current') agentDot1xAuthHistoryResultVlanAssignedType = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("default", 1), ("radius", 2), ("unauthenticatedVlan", 3), ("guestVlan", 4), ("voiceVlan", 5), ("monitorVlan", 6), ("notAssigned", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultVlanAssignedType.setStatus('current') agentDot1xAuthHistoryResultReasonCode = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30))).clone(namedValues=NamedValues(("supplicant-timeout", 1), ("eapol-timeout", 2), ("radius-request-timeout", 3), ("radius-auth-failure", 4), ("radius-auth-comm-failure", 5), ("radius-challenge-process-invalid-nas-port", 6), ("radius-challenge-process-wrong-eap-msg", 7), ("radius-request-send-msg-error", 8), ("radius-accept-process-invalid-nas-port", 9), ("radius-accept-process-wrong-eap-msg", 10), ("radius-accept-filter-assignment-failure", 11), ("radius-accept-diffserv-not-present", 12), ("radius-accept-vlan-assignment-failure", 13), ("vlan-assignment-feature-not-enabled", 14), ("radius-success", 15), ("local-auth-user-not-found", 16), ("local-auth-user-no-access", 17), ("local-auth-md5-validation-failure", 18), ("local-auth-invalid-eap-type", 19), ("local-failure", 20), ("local-success", 21), ("radius-invalid-radius-status", 22), ("guest-vlan-timer-expiry", 23), ("undefined-auth-method", 24), ("reject-auth-method", 25), ("invalid-auth-method", 26), ("auth-method-not-configured", 27), ("unauth-vlan-not-created", 28), ("guest-vlan-not-created", 29), ("radius-accept-invalid-vlan-failure", 30)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultReasonCode.setStatus('current') agentDot1xAuthHistoryResultsClear = MibScalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultsClear.setStatus('current') agentDot1xPortAuthHistoryResultClearTable = MibTable((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3), ) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultClearTable.setStatus('current') agentDot1xPortAuthHistoryResultClearEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3, 1), ).setIndexNames((0, "EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB", "agentDot1xAuthHistoryResultIfIndex")) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultClearEntry.setStatus('current') agentDot1xAuthHistoryResultIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentDot1xAuthHistoryResultIfIndex.setStatus('current') agentDot1xPortAuthHistoryResultsClear = MibTableColumn((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultsClear.setStatus('current') mibBuilder.exportSymbols("EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB", agentDot1xGuestVlanId=agentDot1xGuestVlanId, PYSNMP_MODULE_ID=fastPathdot1xAdvanced, agentDot1xAuthHistoryResultTimeStamp=agentDot1xAuthHistoryResultTimeStamp, agentDot1xAuthHistoryResultVlanAssignedType=agentDot1xAuthHistoryResultVlanAssignedType, Dot1xPortControlMode=Dot1xPortControlMode, agentDot1xMonitorModeEnabled=agentDot1xMonitorModeEnabled, agentDot1xClientFilterID=agentDot1xClientFilterID, agentDot1xDynamicVlanCreationMode=agentDot1xDynamicVlanCreationMode, agentDot1xAuthHistoryResultFilterID=agentDot1xAuthHistoryResultFilterID, agentDot1xAuthHistoryResultIfIndex=agentDot1xAuthHistoryResultIfIndex, agentDot1xPortAuthHistoryResultsClear=agentDot1xPortAuthHistoryResultsClear, agentDot1xClientAuthPAEstate=agentDot1xClientAuthPAEstate, agentDot1xPortVlanAssigned=agentDot1xPortVlanAssigned, agentDot1xMaxUsers=agentDot1xMaxUsers, agentDot1xPortConfigGroup=agentDot1xPortConfigGroup, fastPathdot1xAdvanced=fastPathdot1xAdvanced, agentDot1xAuthHistoryResultsGroup=agentDot1xAuthHistoryResultsGroup, agentDot1xAuthHistoryResultIndex=agentDot1xAuthHistoryResultIndex, agentDot1xAuthHistoryResultReasonCode=agentDot1xAuthHistoryResultReasonCode, agentDot1xAuthHistoryResultMacAddress=agentDot1xAuthHistoryResultMacAddress, agentDot1xPortAuthHistoryResultClearTable=agentDot1xPortAuthHistoryResultClearTable, agentDot1xAuthHistoryResultAge=agentDot1xAuthHistoryResultAge, agentDot1xLogicalPort=agentDot1xLogicalPort, agentDot1xClientTerminationAction=agentDot1xClientTerminationAction, agentDot1xClientConfigEntry=agentDot1xClientConfigEntry, agentDot1xAuthHistoryResultVlanAssigned=agentDot1xAuthHistoryResultVlanAssigned, agentDot1xMonitorModeClients=agentDot1xMonitorModeClients, agentDot1xEnhancementConfigGroup=agentDot1xEnhancementConfigGroup, agentDot1xClientUserName=agentDot1xClientUserName, agentDot1xAuthHistoryResultAccessStatus=agentDot1xAuthHistoryResultAccessStatus, agentDot1xClientConfigGroup=agentDot1xClientConfigGroup, agentDot1xGuestVlanPeriod=agentDot1xGuestVlanPeriod, agentDot1xNonMonitorModeClients=agentDot1xNonMonitorModeClients, agentDot1xAuthHistoryResultVlanId=agentDot1xAuthHistoryResultVlanId, agentDot1xPortAuthHistoryResultClearEntry=agentDot1xPortAuthHistoryResultClearEntry, agentDot1xClientConfigTable=agentDot1xClientConfigTable, agentDot1xPortAuthHistoryResultTable=agentDot1xPortAuthHistoryResultTable, agentDot1xAuthHistoryResultsClear=agentDot1xAuthHistoryResultsClear, agentDot1xPortTerminationAction=agentDot1xPortTerminationAction, Dot1xSessionTerminationAction=Dot1xSessionTerminationAction, agentDot1xPortMABenabledOperational=agentDot1xPortMABenabledOperational, agentDot1xInterface=agentDot1xInterface, agentDot1xUnauthenticatedVlan=agentDot1xUnauthenticatedVlan, agentDot1xClientVlanAssignedReason=agentDot1xClientVlanAssignedReason, agentDot1xEapolFloodMode=agentDot1xEapolFloodMode, agentDot1xPortConfigEntry=agentDot1xPortConfigEntry, agentDot1xClientMacAddress=agentDot1xClientMacAddress, agentDot1xAuthHistoryResultAuthStatus=agentDot1xAuthHistoryResultAuthStatus, agentDot1xPortVlanAssignedReason=agentDot1xPortVlanAssignedReason, agentDot1xPortAuthHistoryResultEntry=agentDot1xPortAuthHistoryResultEntry, agentDot1xAuthHistoryResultIfaceIndex=agentDot1xAuthHistoryResultIfaceIndex, agentDot1xRadiusVlanAssignment=agentDot1xRadiusVlanAssignment, agentDot1xPortConfigTable=agentDot1xPortConfigTable, agentDot1xClientSessionTime=agentDot1xClientSessionTime, agentDot1xClientBackendState=agentDot1xClientBackendState, agentDot1xClientVlanAssigned=agentDot1xClientVlanAssigned, agentDot1xClientSessionTimeout=agentDot1xClientSessionTimeout, agentDot1xPortControlMode=agentDot1xPortControlMode, agentDot1xPortSessionTimeout=agentDot1xPortSessionTimeout, agentDot1xPortMABenabled=agentDot1xPortMABenabled, agentDot1xMonitorModeConfigGroup=agentDot1xMonitorModeConfigGroup)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_union, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueSizeConstraint') (fast_path,) = mibBuilder.importSymbols('EdgeSwitch-REF-MIB', 'fastPath') (dot1x_pae_port_number,) = mibBuilder.importSymbols('IEEE8021-PAE-MIB', 'dot1xPaePortNumber') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (module_identity, iso, ip_address, integer32, counter64, object_identity, notification_type, bits, counter32, gauge32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'iso', 'IpAddress', 'Integer32', 'Counter64', 'ObjectIdentity', 'NotificationType', 'Bits', 'Counter32', 'Gauge32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'TimeTicks') (date_and_time, textual_convention, row_status, mac_address, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'DateAndTime', 'TextualConvention', 'RowStatus', 'MacAddress', 'DisplayString') fast_pathdot1x_advanced = module_identity((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36)) fastPathdot1xAdvanced.setRevisions(('2011-01-26 00:00', '2007-05-23 00:00')) if mibBuilder.loadTexts: fastPathdot1xAdvanced.setLastUpdated('201101260000Z') if mibBuilder.loadTexts: fastPathdot1xAdvanced.setOrganization('Broadcom Inc') class Dot1Xportcontrolmode(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4)) named_values = named_values(('forceUnauthorized', 1), ('auto', 2), ('forceAuthorized', 3), ('macBased', 4)) class Dot1Xsessionterminationaction(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('default', 1), ('reauthenticate', 2)) agent_dot1x_enhancement_config_group = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1)) agent_dot1x_radius_vlan_assignment = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xRadiusVlanAssignment.setStatus('current') agent_dot1x_dynamic_vlan_creation_mode = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xDynamicVlanCreationMode.setStatus('current') agent_dot1x_eapol_flood_mode = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xEapolFloodMode.setStatus('current') agent_dot1x_port_config_group = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2)) agent_dot1x_port_config_table = mib_table((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1)) if mibBuilder.loadTexts: agentDot1xPortConfigTable.setStatus('current') agent_dot1x_port_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1)).setIndexNames((0, 'IEEE8021-PAE-MIB', 'dot1xPaePortNumber')) if mibBuilder.loadTexts: agentDot1xPortConfigEntry.setStatus('current') agent_dot1x_port_control_mode = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 1), dot1x_port_control_mode().clone('auto')).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xPortControlMode.setStatus('current') agent_dot1x_guest_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 2), unsigned32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xGuestVlanId.setStatus('current') agent_dot1x_guest_vlan_period = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 300)).clone(90)).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xGuestVlanPeriod.setStatus('current') agent_dot1x_unauthenticated_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 4), unsigned32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xUnauthenticatedVlan.setStatus('current') agent_dot1x_max_users = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 5), unsigned32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xMaxUsers.setStatus('current') agent_dot1x_port_vlan_assigned = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 6), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xPortVlanAssigned.setStatus('current') agent_dot1x_port_vlan_assigned_reason = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('default', 1), ('radius', 2), ('unauthenticatedVlan', 3), ('guestVlan', 4), ('voiceVlan', 5), ('monitorVlan', 6), ('notAssigned', 7))).clone(5)).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xPortVlanAssignedReason.setStatus('current') agent_dot1x_port_session_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 8), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xPortSessionTimeout.setStatus('current') agent_dot1x_port_termination_action = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 9), dot1x_session_termination_action().clone(1)).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xPortTerminationAction.setStatus('current') agent_dot1x_port_ma_benabled = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone(2)).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xPortMABenabled.setStatus('current') agent_dot1x_port_ma_benabled_operational = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 2, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone(2)).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xPortMABenabledOperational.setStatus('current') agent_dot1x_client_config_group = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3)) agent_dot1x_client_config_table = mib_table((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1)) if mibBuilder.loadTexts: agentDot1xClientConfigTable.setStatus('current') agent_dot1x_client_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1)).setIndexNames((0, 'EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB', 'agentDot1xClientMacAddress')) if mibBuilder.loadTexts: agentDot1xClientConfigEntry.setStatus('current') agent_dot1x_client_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 1), mac_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientMacAddress.setStatus('current') agent_dot1x_logical_port = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 2), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xLogicalPort.setStatus('current') agent_dot1x_interface = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 3), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xInterface.setStatus('current') agent_dot1x_client_auth_pa_estate = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=named_values(('initialize', 1), ('disconnected', 2), ('connecting', 3), ('authenticating', 4), ('authenticated', 5), ('aborting', 6), ('held', 7), ('forceAuth', 8), ('forceUnauth', 9)))).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientAuthPAEstate.setStatus('current') agent_dot1x_client_backend_state = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('request', 1), ('response', 2), ('success', 3), ('fail', 4), ('timeout', 5), ('idle', 6), ('initialize', 7)))).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientBackendState.setStatus('current') agent_dot1x_client_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 6), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientUserName.setStatus('current') agent_dot1x_client_session_time = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 7), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientSessionTime.setStatus('current') agent_dot1x_client_filter_id = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 8), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientFilterID.setStatus('current') agent_dot1x_client_vlan_assigned = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 9), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientVlanAssigned.setStatus('current') agent_dot1x_client_vlan_assigned_reason = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 6, 7))).clone(namedValues=named_values(('default', 1), ('radius', 2), ('unauthenticatedVlan', 3), ('monitorVlan', 6), ('invalid', 7)))).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientVlanAssignedReason.setStatus('current') agent_dot1x_client_session_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 11), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientSessionTimeout.setStatus('current') agent_dot1x_client_termination_action = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 3, 1, 1, 12), dot1x_session_termination_action()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xClientTerminationAction.setStatus('current') agent_dot1x_monitor_mode_config_group = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4)) agent_dot1x_monitor_mode_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xMonitorModeEnabled.setStatus('current') agent_dot1x_monitor_mode_clients = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4, 2), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xMonitorModeClients.setStatus('current') agent_dot1x_non_monitor_mode_clients = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 4, 3), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xNonMonitorModeClients.setStatus('current') agent_dot1x_auth_history_results_group = mib_identifier((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5)) agent_dot1x_port_auth_history_result_table = mib_table((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1)) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultTable.setStatus('current') agent_dot1x_port_auth_history_result_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1)).setIndexNames((0, 'EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB', 'agentDot1xAuthHistoryResultIfaceIndex'), (0, 'EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB', 'agentDot1xAuthHistoryResultIndex')) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultEntry.setStatus('current') agent_dot1x_auth_history_result_iface_index = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 1), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultIfaceIndex.setStatus('current') agent_dot1x_auth_history_result_index = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 2), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultIndex.setStatus('current') agent_dot1x_auth_history_result_time_stamp = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 3), date_and_time()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultTimeStamp.setStatus('current') agent_dot1x_auth_history_result_age = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultAge.setStatus('current') agent_dot1x_auth_history_result_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 5), mac_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultMacAddress.setStatus('current') agent_dot1x_auth_history_result_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 6), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultVlanId.setStatus('current') agent_dot1x_auth_history_result_auth_status = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('success', 1), ('failure', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultAuthStatus.setStatus('current') agent_dot1x_auth_history_result_access_status = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('granted', 1), ('denied', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultAccessStatus.setStatus('current') agent_dot1x_auth_history_result_filter_id = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 9), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultFilterID.setStatus('current') agent_dot1x_auth_history_result_vlan_assigned = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 10), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultVlanAssigned.setStatus('current') agent_dot1x_auth_history_result_vlan_assigned_type = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('default', 1), ('radius', 2), ('unauthenticatedVlan', 3), ('guestVlan', 4), ('voiceVlan', 5), ('monitorVlan', 6), ('notAssigned', 7)))).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultVlanAssignedType.setStatus('current') agent_dot1x_auth_history_result_reason_code = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30))).clone(namedValues=named_values(('supplicant-timeout', 1), ('eapol-timeout', 2), ('radius-request-timeout', 3), ('radius-auth-failure', 4), ('radius-auth-comm-failure', 5), ('radius-challenge-process-invalid-nas-port', 6), ('radius-challenge-process-wrong-eap-msg', 7), ('radius-request-send-msg-error', 8), ('radius-accept-process-invalid-nas-port', 9), ('radius-accept-process-wrong-eap-msg', 10), ('radius-accept-filter-assignment-failure', 11), ('radius-accept-diffserv-not-present', 12), ('radius-accept-vlan-assignment-failure', 13), ('vlan-assignment-feature-not-enabled', 14), ('radius-success', 15), ('local-auth-user-not-found', 16), ('local-auth-user-no-access', 17), ('local-auth-md5-validation-failure', 18), ('local-auth-invalid-eap-type', 19), ('local-failure', 20), ('local-success', 21), ('radius-invalid-radius-status', 22), ('guest-vlan-timer-expiry', 23), ('undefined-auth-method', 24), ('reject-auth-method', 25), ('invalid-auth-method', 26), ('auth-method-not-configured', 27), ('unauth-vlan-not-created', 28), ('guest-vlan-not-created', 29), ('radius-accept-invalid-vlan-failure', 30)))).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultReasonCode.setStatus('current') agent_dot1x_auth_history_results_clear = mib_scalar((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultsClear.setStatus('current') agent_dot1x_port_auth_history_result_clear_table = mib_table((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3)) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultClearTable.setStatus('current') agent_dot1x_port_auth_history_result_clear_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3, 1)).setIndexNames((0, 'EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB', 'agentDot1xAuthHistoryResultIfIndex')) if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultClearEntry.setStatus('current') agent_dot1x_auth_history_result_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3, 1, 1), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: agentDot1xAuthHistoryResultIfIndex.setStatus('current') agent_dot1x_port_auth_history_results_clear = mib_table_column((1, 3, 6, 1, 4, 1, 4413, 1, 1, 36, 5, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: agentDot1xPortAuthHistoryResultsClear.setStatus('current') mibBuilder.exportSymbols('EdgeSwitch-DOT1X-ADVANCED-FEATURES-MIB', agentDot1xGuestVlanId=agentDot1xGuestVlanId, PYSNMP_MODULE_ID=fastPathdot1xAdvanced, agentDot1xAuthHistoryResultTimeStamp=agentDot1xAuthHistoryResultTimeStamp, agentDot1xAuthHistoryResultVlanAssignedType=agentDot1xAuthHistoryResultVlanAssignedType, Dot1xPortControlMode=Dot1xPortControlMode, agentDot1xMonitorModeEnabled=agentDot1xMonitorModeEnabled, agentDot1xClientFilterID=agentDot1xClientFilterID, agentDot1xDynamicVlanCreationMode=agentDot1xDynamicVlanCreationMode, agentDot1xAuthHistoryResultFilterID=agentDot1xAuthHistoryResultFilterID, agentDot1xAuthHistoryResultIfIndex=agentDot1xAuthHistoryResultIfIndex, agentDot1xPortAuthHistoryResultsClear=agentDot1xPortAuthHistoryResultsClear, agentDot1xClientAuthPAEstate=agentDot1xClientAuthPAEstate, agentDot1xPortVlanAssigned=agentDot1xPortVlanAssigned, agentDot1xMaxUsers=agentDot1xMaxUsers, agentDot1xPortConfigGroup=agentDot1xPortConfigGroup, fastPathdot1xAdvanced=fastPathdot1xAdvanced, agentDot1xAuthHistoryResultsGroup=agentDot1xAuthHistoryResultsGroup, agentDot1xAuthHistoryResultIndex=agentDot1xAuthHistoryResultIndex, agentDot1xAuthHistoryResultReasonCode=agentDot1xAuthHistoryResultReasonCode, agentDot1xAuthHistoryResultMacAddress=agentDot1xAuthHistoryResultMacAddress, agentDot1xPortAuthHistoryResultClearTable=agentDot1xPortAuthHistoryResultClearTable, agentDot1xAuthHistoryResultAge=agentDot1xAuthHistoryResultAge, agentDot1xLogicalPort=agentDot1xLogicalPort, agentDot1xClientTerminationAction=agentDot1xClientTerminationAction, agentDot1xClientConfigEntry=agentDot1xClientConfigEntry, agentDot1xAuthHistoryResultVlanAssigned=agentDot1xAuthHistoryResultVlanAssigned, agentDot1xMonitorModeClients=agentDot1xMonitorModeClients, agentDot1xEnhancementConfigGroup=agentDot1xEnhancementConfigGroup, agentDot1xClientUserName=agentDot1xClientUserName, agentDot1xAuthHistoryResultAccessStatus=agentDot1xAuthHistoryResultAccessStatus, agentDot1xClientConfigGroup=agentDot1xClientConfigGroup, agentDot1xGuestVlanPeriod=agentDot1xGuestVlanPeriod, agentDot1xNonMonitorModeClients=agentDot1xNonMonitorModeClients, agentDot1xAuthHistoryResultVlanId=agentDot1xAuthHistoryResultVlanId, agentDot1xPortAuthHistoryResultClearEntry=agentDot1xPortAuthHistoryResultClearEntry, agentDot1xClientConfigTable=agentDot1xClientConfigTable, agentDot1xPortAuthHistoryResultTable=agentDot1xPortAuthHistoryResultTable, agentDot1xAuthHistoryResultsClear=agentDot1xAuthHistoryResultsClear, agentDot1xPortTerminationAction=agentDot1xPortTerminationAction, Dot1xSessionTerminationAction=Dot1xSessionTerminationAction, agentDot1xPortMABenabledOperational=agentDot1xPortMABenabledOperational, agentDot1xInterface=agentDot1xInterface, agentDot1xUnauthenticatedVlan=agentDot1xUnauthenticatedVlan, agentDot1xClientVlanAssignedReason=agentDot1xClientVlanAssignedReason, agentDot1xEapolFloodMode=agentDot1xEapolFloodMode, agentDot1xPortConfigEntry=agentDot1xPortConfigEntry, agentDot1xClientMacAddress=agentDot1xClientMacAddress, agentDot1xAuthHistoryResultAuthStatus=agentDot1xAuthHistoryResultAuthStatus, agentDot1xPortVlanAssignedReason=agentDot1xPortVlanAssignedReason, agentDot1xPortAuthHistoryResultEntry=agentDot1xPortAuthHistoryResultEntry, agentDot1xAuthHistoryResultIfaceIndex=agentDot1xAuthHistoryResultIfaceIndex, agentDot1xRadiusVlanAssignment=agentDot1xRadiusVlanAssignment, agentDot1xPortConfigTable=agentDot1xPortConfigTable, agentDot1xClientSessionTime=agentDot1xClientSessionTime, agentDot1xClientBackendState=agentDot1xClientBackendState, agentDot1xClientVlanAssigned=agentDot1xClientVlanAssigned, agentDot1xClientSessionTimeout=agentDot1xClientSessionTimeout, agentDot1xPortControlMode=agentDot1xPortControlMode, agentDot1xPortSessionTimeout=agentDot1xPortSessionTimeout, agentDot1xPortMABenabled=agentDot1xPortMABenabled, agentDot1xMonitorModeConfigGroup=agentDot1xMonitorModeConfigGroup)
#!/usr/bin/python class User(object): def __init__(self,conn, addr,name=None): self.name = name self.conn = conn self.addr = addr class Player(User): def __init__(self,conn,addr,name=None): super(Player,self).__init__(conn,addr,name) self.passwd = None self.score = 0 self.guesses = 0 def send(self,msg): self.conn.send(msg) def recv(self): d = self.conn.recv(4096) if d == "": return None else: return d
class User(object): def __init__(self, conn, addr, name=None): self.name = name self.conn = conn self.addr = addr class Player(User): def __init__(self, conn, addr, name=None): super(Player, self).__init__(conn, addr, name) self.passwd = None self.score = 0 self.guesses = 0 def send(self, msg): self.conn.send(msg) def recv(self): d = self.conn.recv(4096) if d == '': return None else: return d
def pkcs_7_padding(block,N=16): if N >= 256: raise Exception('N is too large.') num_remaining = N - len(block) % N return block + (chr(num_remaining) * num_remaining).encode('utf-8') if __name__ == '__main__': print(pkcs_7_padding(b'YELLOW SUBMARINE', 20))
def pkcs_7_padding(block, N=16): if N >= 256: raise exception('N is too large.') num_remaining = N - len(block) % N return block + (chr(num_remaining) * num_remaining).encode('utf-8') if __name__ == '__main__': print(pkcs_7_padding(b'YELLOW SUBMARINE', 20))
# # @lc app=leetcode id=487 lang=python3 # # [487] Max Consecutive Ones II # # @lc code=start class Solution: def findMaxConsecutiveOnes(self, nums): curzero = 0 lp = 0 rp = 0 mxlen = 0 while rp < len(nums): if nums[rp] == 0: curzero += 1 if curzero > 1: mxlen = max(mxlen, rp - lp) while curzero > 1: if nums[lp] == 0: curzero -= 1 lp += 1 rp += 1 mxlen = max(mxlen, rp - lp) return mxlen a = Solution() b = a.findMaxConsecutiveOnes([1,0,1,1,0,1]) print(b) # @lc code=end
class Solution: def find_max_consecutive_ones(self, nums): curzero = 0 lp = 0 rp = 0 mxlen = 0 while rp < len(nums): if nums[rp] == 0: curzero += 1 if curzero > 1: mxlen = max(mxlen, rp - lp) while curzero > 1: if nums[lp] == 0: curzero -= 1 lp += 1 rp += 1 mxlen = max(mxlen, rp - lp) return mxlen a = solution() b = a.findMaxConsecutiveOnes([1, 0, 1, 1, 0, 1]) print(b)
number1 = int (input()) number2 = int (input()) if number1 >= number2: print('Greater number: ', number1) elif number2 > number1: print('Greater number: ', number2) else: print()
number1 = int(input()) number2 = int(input()) if number1 >= number2: print('Greater number: ', number1) elif number2 > number1: print('Greater number: ', number2) else: print()
# -*- coding: utf-8 -*- name = 'turret_resolver' version = '1.1.3.0' authors = ['wen.tan', 'ben.skinner', 'daniel.flood'] build_requires = ['python'] build_command = 'rez env python -c "python {root}/rezbuild.py {install}"' requires = ['pgtk', 'tk_core'] def commands(): env.PYTHONPATH.append('{root}/python') env.RESOLVE.set("{root}/bin/turret-resolver.bat") env.PATH.append('{root}/bin')
name = 'turret_resolver' version = '1.1.3.0' authors = ['wen.tan', 'ben.skinner', 'daniel.flood'] build_requires = ['python'] build_command = 'rez env python -c "python {root}/rezbuild.py {install}"' requires = ['pgtk', 'tk_core'] def commands(): env.PYTHONPATH.append('{root}/python') env.RESOLVE.set('{root}/bin/turret-resolver.bat') env.PATH.append('{root}/bin')
def sum(num): return num + num def squre(num): return num * num
def sum(num): return num + num def squre(num): return num * num
# lextab.py. This file automatically created by PLY (version 2.2). Don't edit! _lextokens = {'HEADER_NAME': None, 'IDENTIFIER': None, 'PP_NUMBER': None, 'CHARACTER_CONSTANT': None, 'STRING_LITERAL': None, 'OTHER': None, 'PTR_OP': None, 'INC_OP': None, 'DEC_OP': None, 'LEFT_OP': None, 'RIGHT_OP': None, 'LE_OP': None, 'GE_OP': None, 'EQ_OP': None, 'NE_OP': None, 'AND_OP': None, 'OR_OP': None, 'MUL_ASSIGN': None, 'DIV_ASSIGN': None, 'MOD_ASSIGN': None, 'ADD_ASSIGN': None, 'SUB_ASSIGN': None, 'LEFT_ASSIGN': None, 'RIGHT_ASSIGN': None, 'AND_ASSIGN': None, 'XOR_ASSIGN': None, 'OR_ASSIGN': None, 'PERIOD': None, 'ELLIPSIS': None, 'LPAREN': None, 'NEWLINE': None, 'PP_DEFINE': None, 'PP_DEFINE_NAME': None, 'PP_DEFINE_MACRO_NAME': None, 'PP_MACRO_PARAM': None, 'PP_STRINGIFY': None, 'PP_IDENTIFIER_PASTE': None, 'PP_END_DEFINE': None} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'INITIAL': 'inclusive', 'DEFINE': 'exclusive'} _lexstatere = {'INITIAL': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\+\\+|\\|\\||>>=|<<=|\\+=|\\*=|\\^=|\\|=|-=|/=|%=|&=|>>|<<|--|->|&&|<=|>=|==|!=|<:|:>|<%|%>|\\)|\\[|\\.|\\+|\\*|\\^|\\||\\?|;|{|}|,|:|=|]|&|!|~|-|/|%|<|>))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_INITIAL_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_INITIAL_identifier', 'INITIAL_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t_ANY_int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:0[0-7]*)|(?:[1-9][0-9]*))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_INITIAL_newline>\\n)|(?P<t_INITIAL_pp_define>\\#define)', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_INITIAL_newline', 'INITIAL_newline'), ('t_INITIAL_pp_define', 'INITIAL_pp_define')])], 'DEFINE': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\+\\+|\\|\\||>>=|<<=|\\+=|\\*=|\\^=|\\|=|-=|/=|%=|&=|>>|<<|--|->|&&|<=|>=|==|!=|<:|:>|<%|%>|\\)|\\[|\\.|\\+|\\*|\\^|\\||\\?|;|{|}|,|:|=|]|&|!|~|-|/|%|<|>))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_DEFINE_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_DEFINE_identifier', 'DEFINE_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t_ANY_int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:0[0-7]*)|(?:[1-9][0-9]*))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_DEFINE_newline>\\n)|(?P<t_DEFINE_pp_param_op>(\\#\\#)|(\\#))', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_DEFINE_newline', 'DEFINE_newline'), ('t_DEFINE_pp_param_op', 'DEFINE_pp_param_op')])]} _lexstateignore = {'INITIAL': ' \t\x0b\x0c\r', 'DEFINE': ' \t\x0b\x0c\r'} _lexstateerrorf = {'INITIAL': 't_INITIAL_error', 'DEFINE': 't_DEFINE_error'}
_lextokens = {'HEADER_NAME': None, 'IDENTIFIER': None, 'PP_NUMBER': None, 'CHARACTER_CONSTANT': None, 'STRING_LITERAL': None, 'OTHER': None, 'PTR_OP': None, 'INC_OP': None, 'DEC_OP': None, 'LEFT_OP': None, 'RIGHT_OP': None, 'LE_OP': None, 'GE_OP': None, 'EQ_OP': None, 'NE_OP': None, 'AND_OP': None, 'OR_OP': None, 'MUL_ASSIGN': None, 'DIV_ASSIGN': None, 'MOD_ASSIGN': None, 'ADD_ASSIGN': None, 'SUB_ASSIGN': None, 'LEFT_ASSIGN': None, 'RIGHT_ASSIGN': None, 'AND_ASSIGN': None, 'XOR_ASSIGN': None, 'OR_ASSIGN': None, 'PERIOD': None, 'ELLIPSIS': None, 'LPAREN': None, 'NEWLINE': None, 'PP_DEFINE': None, 'PP_DEFINE_NAME': None, 'PP_DEFINE_MACRO_NAME': None, 'PP_MACRO_PARAM': None, 'PP_STRINGIFY': None, 'PP_IDENTIFIER_PASTE': None, 'PP_END_DEFINE': None} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'INITIAL': 'inclusive', 'DEFINE': 'exclusive'} _lexstatere = {'INITIAL': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\+\\+|\\|\\||>>=|<<=|\\+=|\\*=|\\^=|\\|=|-=|/=|%=|&=|>>|<<|--|->|&&|<=|>=|==|!=|<:|:>|<%|%>|\\)|\\[|\\.|\\+|\\*|\\^|\\||\\?|;|{|}|,|:|=|]|&|!|~|-|/|%|<|>))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_INITIAL_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_INITIAL_identifier', 'INITIAL_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t_ANY_int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:0[0-7]*)|(?:[1-9][0-9]*))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_INITIAL_newline>\\n)|(?P<t_INITIAL_pp_define>\\#define)', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_INITIAL_newline', 'INITIAL_newline'), ('t_INITIAL_pp_define', 'INITIAL_pp_define')])], 'DEFINE': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\+\\+|\\|\\||>>=|<<=|\\+=|\\*=|\\^=|\\|=|-=|/=|%=|&=|>>|<<|--|->|&&|<=|>=|==|!=|<:|:>|<%|%>|\\)|\\[|\\.|\\+|\\*|\\^|\\||\\?|;|{|}|,|:|=|]|&|!|~|-|/|%|<|>))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_DEFINE_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_DEFINE_identifier', 'DEFINE_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t_ANY_int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:0[0-7]*)|(?:[1-9][0-9]*))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_DEFINE_newline>\\n)|(?P<t_DEFINE_pp_param_op>(\\#\\#)|(\\#))', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_DEFINE_newline', 'DEFINE_newline'), ('t_DEFINE_pp_param_op', 'DEFINE_pp_param_op')])]} _lexstateignore = {'INITIAL': ' \t\x0b\x0c\r', 'DEFINE': ' \t\x0b\x0c\r'} _lexstateerrorf = {'INITIAL': 't_INITIAL_error', 'DEFINE': 't_DEFINE_error'}
num_students = int(input()) students = {} for _ in range(num_students): name, grade = input().split(' ') if name not in students: students[name] = [] students[name].append(float(grade)) for name, grades in students.items(): average_grade = sum(grades) / len(grades) grades = [f'{x:.2f}' for x in grades] print(f"{name} -> {' '.join(grades)} (avg: {average_grade:.2f})")
num_students = int(input()) students = {} for _ in range(num_students): (name, grade) = input().split(' ') if name not in students: students[name] = [] students[name].append(float(grade)) for (name, grades) in students.items(): average_grade = sum(grades) / len(grades) grades = [f'{x:.2f}' for x in grades] print(f"{name} -> {' '.join(grades)} (avg: {average_grade:.2f})")
#Paula Duffy 2018-02-06 #Collatz Conjecture - Week 3 Exercise n = int(input("Please enter an integer: ")) while n > 1: if n % 2 == 0: n = n // 2 #divide by 2 if integer is even print (n) elif n % 2 == 1: n = (n * 3) + 1 #multiply by 3 and add 1 if integer is not even print (n)
n = int(input('Please enter an integer: ')) while n > 1: if n % 2 == 0: n = n // 2 print(n) elif n % 2 == 1: n = n * 3 + 1 print(n)
def add(a,b): return a+b def sub(a,b): return a-b def mul(a,b): return a*b def div(a,b): return a/b print(__name__)
def add(a, b): return a + b def sub(a, b): return a - b def mul(a, b): return a * b def div(a, b): return a / b print(__name__)
class ObjectView(dict): def __init__(self, *args, **kwargs): super(ObjectView, self).__init__(**kwargs) for arg in args: if not arg: continue elif isinstance(arg, dict): for key, val in arg.items(): self[key] = val else: raise TypeError() for key, val in kwargs.items(): self[key] = val def __setattr__(self, key, value): if not hasattr(ObjectView, key): self[key] = value else: raise def __setitem__(self, name, value): value = ObjectView(value) if isinstance(value, dict) else value super(ObjectView, self).__setitem__(name, value) def __getattr__(self, item): return self.__getitem__(item) def __getitem__(self, name): if name not in self: self[name] = {} return super(ObjectView, self).__getitem__(name) def __delattr__(self, name): del self[name]
class Objectview(dict): def __init__(self, *args, **kwargs): super(ObjectView, self).__init__(**kwargs) for arg in args: if not arg: continue elif isinstance(arg, dict): for (key, val) in arg.items(): self[key] = val else: raise type_error() for (key, val) in kwargs.items(): self[key] = val def __setattr__(self, key, value): if not hasattr(ObjectView, key): self[key] = value else: raise def __setitem__(self, name, value): value = object_view(value) if isinstance(value, dict) else value super(ObjectView, self).__setitem__(name, value) def __getattr__(self, item): return self.__getitem__(item) def __getitem__(self, name): if name not in self: self[name] = {} return super(ObjectView, self).__getitem__(name) def __delattr__(self, name): del self[name]
# Problem: # Write a program that reads a number of integer numbers entered by the user and sums them. num_of_loops = int(input()) sum = 0; for i in range(1, num_of_loops + 1): num = int(input()) sum += num print(sum)
num_of_loops = int(input()) sum = 0 for i in range(1, num_of_loops + 1): num = int(input()) sum += num print(sum)
#!/usr/bin/env python scores = { "pullups": [(4,20), (5,23), (5,23), (5,23), (5,21), (5,20), (5,19), (4,19)], "crunches": [ (70,105), (70,110), (70,115), (70,115), (70,110), (65,105), (50,100), (40,100), ], "run": [ (18 * 60,27 * 60 + 40), (18 * 60,27 * 60 + 40), (18 * 60,28 * 60 + 00), (18 * 60,28 * 60 + 40), (18 * 60,28 * 60 + 40), (18 * 60 + 30,29 * 60 + 40), (19 * 60,30 * 60 + 40), (19 * 60 + 30,33 * 60 + 40), ], } def pullup_score(lower, upper): pullups = int(input("Pullups: ")) if pullups > upper: return 100 elif pullups < lower: return 0 else: range = upper - lower pct_through = (pullups - lower) / range * 100 return int(pct_through) def run_score(lower, upper): runtime = input("Runtime: ") hh, mm = [int(v) for v in runtime.split(":")] runtime = hh*60 + mm if runtime > upper: return 100 elif runtime < lower: return 0 else: range = upper - lower pct_through = (runtime - lower) / range * 100 return int(100-pct_through) def crunch_score(lower, upper): crunches = int(input("Crunches: ")) if crunches > upper: return 100 elif crunches < lower: return 0 else: range = upper - lower pct_through = (crunches - lower) / range * 100 return int(pct_through) def score_bracket(age): if age >= 17 and age <= 20: return 0 elif age >= 21 and age <= 25: return 1 elif age >= 26 and age <= 30: return 2 elif age >= 31 and age <= 35: return 3 elif age >= 36 and age <= 40: return 4 elif age >= 41 and age <= 45: return 5 elif age >= 46 and age <= 50: return 6 elif age >= 51: return 7 else: print("Age must be >= 17") age = input("Age: ") return score_bracket(age) def main(): age = 30 bracket = score_bracket(age) pullup = pullup_score(*scores['pullups'][bracket]) print(pullup) crunch = crunch_score(*scores['crunches'][bracket]) print(crunch) run = run_score(*scores['run'][bracket]) print(run) print("Total:", pullup + crunch + run, "out of 300") if __name__ == "__main__": main()
scores = {'pullups': [(4, 20), (5, 23), (5, 23), (5, 23), (5, 21), (5, 20), (5, 19), (4, 19)], 'crunches': [(70, 105), (70, 110), (70, 115), (70, 115), (70, 110), (65, 105), (50, 100), (40, 100)], 'run': [(18 * 60, 27 * 60 + 40), (18 * 60, 27 * 60 + 40), (18 * 60, 28 * 60 + 0), (18 * 60, 28 * 60 + 40), (18 * 60, 28 * 60 + 40), (18 * 60 + 30, 29 * 60 + 40), (19 * 60, 30 * 60 + 40), (19 * 60 + 30, 33 * 60 + 40)]} def pullup_score(lower, upper): pullups = int(input('Pullups: ')) if pullups > upper: return 100 elif pullups < lower: return 0 else: range = upper - lower pct_through = (pullups - lower) / range * 100 return int(pct_through) def run_score(lower, upper): runtime = input('Runtime: ') (hh, mm) = [int(v) for v in runtime.split(':')] runtime = hh * 60 + mm if runtime > upper: return 100 elif runtime < lower: return 0 else: range = upper - lower pct_through = (runtime - lower) / range * 100 return int(100 - pct_through) def crunch_score(lower, upper): crunches = int(input('Crunches: ')) if crunches > upper: return 100 elif crunches < lower: return 0 else: range = upper - lower pct_through = (crunches - lower) / range * 100 return int(pct_through) def score_bracket(age): if age >= 17 and age <= 20: return 0 elif age >= 21 and age <= 25: return 1 elif age >= 26 and age <= 30: return 2 elif age >= 31 and age <= 35: return 3 elif age >= 36 and age <= 40: return 4 elif age >= 41 and age <= 45: return 5 elif age >= 46 and age <= 50: return 6 elif age >= 51: return 7 else: print('Age must be >= 17') age = input('Age: ') return score_bracket(age) def main(): age = 30 bracket = score_bracket(age) pullup = pullup_score(*scores['pullups'][bracket]) print(pullup) crunch = crunch_score(*scores['crunches'][bracket]) print(crunch) run = run_score(*scores['run'][bracket]) print(run) print('Total:', pullup + crunch + run, 'out of 300') if __name__ == '__main__': main()
# https://github.com/cthoyt/cookiecutter-snekpack how to make folder structure # https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-14-340 article for this analysis CRED = '\033[91m' CEND = '\033[0m' EXPRESSION = "../../data/GSE161533.top.table.tsv" EXPRESSION2 = "../../data/GGSE54129.top.table.tsv" INTERACTION = "../../data/gene_interaction_map.tsv" PATHWAY = "../../data/VEGF_signaling_pathw.txt"
cred = '\x1b[91m' cend = '\x1b[0m' expression = '../../data/GSE161533.top.table.tsv' expression2 = '../../data/GGSE54129.top.table.tsv' interaction = '../../data/gene_interaction_map.tsv' pathway = '../../data/VEGF_signaling_pathw.txt'
f = [0,1] n = int(input("numar:")) for i in range(2, n+1): f.append(f[i-1]+f[i-2]) print(f)
f = [0, 1] n = int(input('numar:')) for i in range(2, n + 1): f.append(f[i - 1] + f[i - 2]) print(f)
# -*- coding: utf-8 -*- # Scrapy settings for tech163 project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'money163' SPIDER_MODULES = ['money163.spiders'] NEWSPIDER_MODULE = 'money163.spiders' ITEM_PIPELINES = {'money163.pipelines.Money163Pipeline':300,} # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'tech163 (+http://www.yourdomain.com)' USER_AGENT = 'Mozilla/5.0 (X11; Windows x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.7' DOWNLOAD_TIMEOUT = 35 DOWNLOAD_DELAY = 0.5 # LOG_LEVEL = "INFO" # LOG_STDOUT = True # LOG_FILE = "log/newsSpider.log"
bot_name = 'money163' spider_modules = ['money163.spiders'] newspider_module = 'money163.spiders' item_pipelines = {'money163.pipelines.Money163Pipeline': 300} user_agent = 'Mozilla/5.0 (X11; Windows x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.7' download_timeout = 35 download_delay = 0.5
def first_letter_of_word(current_word): digits = [] new_current_word = [] for letter in current_word: if letter.isdigit(): digits.append(letter) elif letter.isalpha(): new_current_word.append(letter) first_letter = chr(int("".join(digits))) new_current_word.insert(0, first_letter) return new_current_word def change_chars(new_current_word): new_current_word[1], new_current_word[-1] = new_current_word[-1], new_current_word[1] return new_current_word def add_uncripted_word(new_current_word, new_message_list: list): new_current_word = "".join(new_current_word) new_message_list.append(new_current_word) return new_message_list def organize_words(unsecret_message): unsecret_message = " ".join(unsecret_message) return unsecret_message secret_message = input().split(" ") new_message = [] for word in secret_message: new_word = first_letter_of_word(word) new_word = change_chars(new_word) new_message = add_uncripted_word(new_word, new_message) new_message = organize_words(new_message) print(new_message)
def first_letter_of_word(current_word): digits = [] new_current_word = [] for letter in current_word: if letter.isdigit(): digits.append(letter) elif letter.isalpha(): new_current_word.append(letter) first_letter = chr(int(''.join(digits))) new_current_word.insert(0, first_letter) return new_current_word def change_chars(new_current_word): (new_current_word[1], new_current_word[-1]) = (new_current_word[-1], new_current_word[1]) return new_current_word def add_uncripted_word(new_current_word, new_message_list: list): new_current_word = ''.join(new_current_word) new_message_list.append(new_current_word) return new_message_list def organize_words(unsecret_message): unsecret_message = ' '.join(unsecret_message) return unsecret_message secret_message = input().split(' ') new_message = [] for word in secret_message: new_word = first_letter_of_word(word) new_word = change_chars(new_word) new_message = add_uncripted_word(new_word, new_message) new_message = organize_words(new_message) print(new_message)
N = int(input()) line = [] for a in range(N): line.append(int(input())) total = 0 curIter = 1 while min(line) < 999999: valleys = [] for a in range(N): if line[a] < 999999: if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]): valleys.append(a) for a in valleys: line[a] = 999999 total += (curIter * len(valleys)) curIter += 1 print(total)
n = int(input()) line = [] for a in range(N): line.append(int(input())) total = 0 cur_iter = 1 while min(line) < 999999: valleys = [] for a in range(N): if line[a] < 999999: if (a == 0 or line[a] <= line[a - 1]) and (a == N - 1 or line[a] <= line[a + 1]): valleys.append(a) for a in valleys: line[a] = 999999 total += curIter * len(valleys) cur_iter += 1 print(total)
def invert_binary_tree(node): if node: node.left, node.right = invert_binary_tree(node.right), invert_binary_tree(node.left) return node class BinaryTreeNode(object): def __init__(self, value, left=None, right=None): self.value = value self.left = None self.right = None btn_root = BinaryTreeNode(10) btn_1 = BinaryTreeNode(8) btn_2 = BinaryTreeNode(9) btn_root.left = btn_1 btn_root.right = btn_2 print(btn_root.left.value) print(btn_root.right.value) btn_root = invert_binary_tree(btn_root) print(btn_root.left.value) print(btn_root.right.value)
def invert_binary_tree(node): if node: (node.left, node.right) = (invert_binary_tree(node.right), invert_binary_tree(node.left)) return node class Binarytreenode(object): def __init__(self, value, left=None, right=None): self.value = value self.left = None self.right = None btn_root = binary_tree_node(10) btn_1 = binary_tree_node(8) btn_2 = binary_tree_node(9) btn_root.left = btn_1 btn_root.right = btn_2 print(btn_root.left.value) print(btn_root.right.value) btn_root = invert_binary_tree(btn_root) print(btn_root.left.value) print(btn_root.right.value)
#!/usr/bin/env python3 def selection_sort(lst): length = len(lst) for i in range(length - 1): least = i for k in range(i + 1, length): if lst[k] < lst[least]: least = k lst[least], lst[i] = (lst[i], lst[least]) return lst print(selection_sort([5, 2, 4, 6, 1, 3]))
def selection_sort(lst): length = len(lst) for i in range(length - 1): least = i for k in range(i + 1, length): if lst[k] < lst[least]: least = k (lst[least], lst[i]) = (lst[i], lst[least]) return lst print(selection_sort([5, 2, 4, 6, 1, 3]))
count = input('How many people will be in the dinner group? ') count = int(count) if count > 8: print('You\'ll have to wait for a table.') else: print('The table is ready.')
count = input('How many people will be in the dinner group? ') count = int(count) if count > 8: print("You'll have to wait for a table.") else: print('The table is ready.')
# Automatically generated # pylint: disable=all get = [{'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'ValidCores': [1], 'ValidThreadsPerCore': [1], 'SizeInMiB': 2048, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 2, 'Ipv4AddressesPerInterface': 4, 'Ipv6AddressesPerInterface': 4, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.medium', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'ValidCores': [1], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 2048}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 2, 'Ipv4AddressesPerInterface': 4, 'Ipv6AddressesPerInterface': 4, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 2, 'DefaultCores': 2, 'DefaultThreadsPerCore': 1, 'ValidCores': [2], 'ValidThreadsPerCore': [1], 'SizeInMiB': 4096, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 3, 'Ipv4AddressesPerInterface': 10, 'Ipv6AddressesPerInterface': 10, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.large', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 2, 'DefaultCores': 2, 'DefaultThreadsPerCore': 1, 'ValidCores': [2], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 4096}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 3, 'Ipv4AddressesPerInterface': 10, 'Ipv6AddressesPerInterface': 10, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 4, 'DefaultCores': 4, 'DefaultThreadsPerCore': 1, 'ValidCores': [4], 'ValidThreadsPerCore': [1], 'SizeInMiB': 8192, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.xlarge', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 4, 'DefaultCores': 4, 'DefaultThreadsPerCore': 1, 'ValidCores': [4], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 8192}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 8, 'DefaultCores': 8, 'DefaultThreadsPerCore': 1, 'ValidCores': [8], 'ValidThreadsPerCore': [1], 'SizeInMiB': 16384, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.2xlarge', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 8, 'DefaultCores': 8, 'DefaultThreadsPerCore': 1, 'ValidCores': [8], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 16384}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 16, 'DefaultCores': 16, 'DefaultThreadsPerCore': 1, 'ValidCores': [16], 'ValidThreadsPerCore': [1], 'SizeInMiB': 32768, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.4xlarge', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 16, 'DefaultCores': 16, 'DefaultThreadsPerCore': 1, 'ValidCores': [16], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 32768}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 16, 'SizeInMiB': 32768, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.metal', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': True, 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 16}, 'MemoryInfo': {'SizeInMiB': 32768}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}] # noqa: E501 def get_instances_list() -> list: '''Returns list EC2 instances with InstanceType = a .''' # pylint: disable=all return get
get = [{'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'ValidCores': [1], 'ValidThreadsPerCore': [1], 'SizeInMiB': 2048, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 2, 'Ipv4AddressesPerInterface': 4, 'Ipv6AddressesPerInterface': 4, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.medium', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'ValidCores': [1], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 2048}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 2, 'Ipv4AddressesPerInterface': 4, 'Ipv6AddressesPerInterface': 4, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 2, 'DefaultCores': 2, 'DefaultThreadsPerCore': 1, 'ValidCores': [2], 'ValidThreadsPerCore': [1], 'SizeInMiB': 4096, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 3, 'Ipv4AddressesPerInterface': 10, 'Ipv6AddressesPerInterface': 10, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.large', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 2, 'DefaultCores': 2, 'DefaultThreadsPerCore': 1, 'ValidCores': [2], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 4096}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 3, 'Ipv4AddressesPerInterface': 10, 'Ipv6AddressesPerInterface': 10, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 4, 'DefaultCores': 4, 'DefaultThreadsPerCore': 1, 'ValidCores': [4], 'ValidThreadsPerCore': [1], 'SizeInMiB': 8192, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.xlarge', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 4, 'DefaultCores': 4, 'DefaultThreadsPerCore': 1, 'ValidCores': [4], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 8192}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 8, 'DefaultCores': 8, 'DefaultThreadsPerCore': 1, 'ValidCores': [8], 'ValidThreadsPerCore': [1], 'SizeInMiB': 16384, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.2xlarge', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 8, 'DefaultCores': 8, 'DefaultThreadsPerCore': 1, 'ValidCores': [8], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 16384}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 4, 'Ipv4AddressesPerInterface': 15, 'Ipv6AddressesPerInterface': 15, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 16, 'DefaultCores': 16, 'DefaultThreadsPerCore': 1, 'ValidCores': [16], 'ValidThreadsPerCore': [1], 'SizeInMiB': 32768, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.4xlarge', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': False, 'Hypervisor': 'nitro', 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 16, 'DefaultCores': 16, 'DefaultThreadsPerCore': 1, 'ValidCores': [16], 'ValidThreadsPerCore': [1]}, 'MemoryInfo': {'SizeInMiB': 32768}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}, {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 16, 'SizeInMiB': 32768, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required', 'SupportedStrategies': ['cluster', 'partition', 'spread'], 'InstanceType': 'a1.metal', 'CurrentGeneration': True, 'FreeTierEligible': False, 'SupportedUsageClasses': ['on-demand', 'spot'], 'SupportedRootDeviceTypes': ['ebs'], 'BareMetal': True, 'ProcessorInfo': {'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3}, 'VCpuInfo': {'DefaultVCpus': 16}, 'MemoryInfo': {'SizeInMiB': 32768}, 'InstanceStorageSupported': False, 'EbsInfo': {'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported'}, 'NetworkInfo': {'NetworkPerformance': 'Up to 10 Gigabit', 'MaximumNetworkInterfaces': 8, 'Ipv4AddressesPerInterface': 30, 'Ipv6AddressesPerInterface': 30, 'Ipv6Supported': True, 'EnaSupport': 'required'}, 'PlacementGroupInfo': {'SupportedStrategies': ['cluster', 'partition', 'spread']}, 'HibernationSupported': False, 'BurstablePerformanceSupported': False, 'DedicatedHostsSupported': True, 'AutoRecoverySupported': True}] def get_instances_list() -> list: """Returns list EC2 instances with InstanceType = a .""" return get
# https://stockmarketmba.com/globalstockexchanges.php exchanges = { 'USA': None, 'Germany': 'XETR', 'Hong Kong': 'XHKG', 'Japan': 'XTKS', 'France': 'XPAR', 'Canada': 'XTSE', 'United Kingdom': 'XLON', 'Switzerland': 'XSWX', 'Australia': 'XASX', 'South Korea': 'XKRX', 'The Netherlands': 'XAMS', 'Spain': 'XMAD', 'Russia': 'MISX', 'Italy': 'XMIL', 'Belgium': 'XBRU', 'Mexiko': 'XMEX', 'Sweden': 'XSTO', 'Norway': 'XOSL', 'Finland': 'XHEL', 'Denmark': 'XCSE', 'Austria': 'XWBO' } exchanges_untested = { 'Argentina': 'XBUE', 'Australia_XNEC': 'XNEC', 'Australia': 'XASX', 'Austria': 'XWBO', 'Bahrain': 'XBAH', 'Bangladesh': 'XDHA', 'Belgium': 'XBRU', 'Brazil': 'BVMF', 'Canada_XCNQ': 'XCNQ', 'Canada': 'XTSE', 'Canada_XTSX': 'XTSX', 'Canada_NEOE': 'NEOE', 'Chile': 'XSGO', 'China_SHG': 'XSHG', 'China': 'XSHE', 'Colombia': 'XBOG', 'Croatia': 'XZAG', 'Cyprus': 'XCYS', 'Czech Republic': 'XPRA', 'Denmark': 'XCSE', 'Egypt': 'XCAI', 'Finland': 'XHEL', 'France': 'XPAR', 'Germany_XEQT': 'XEQT', 'Germany_XBER': 'XBER', 'Germany_XDUS': 'XDUS', 'Germany_XFRA': 'XFRA', 'Germany_XMUN': 'XMUN', 'Germany_XSTU': 'XSTU', 'Germany': 'XETR', 'Germany_XQTX': 'XQTX', 'Greece': 'XATH', 'Hong Kong': 'XHKG', 'Hungary': 'XBUD', 'Iceland': 'XICE', 'India_XBOM': 'XBOM', 'India': 'XNSE', 'Indonesia': 'XIDX', 'Ireland': 'XDUB', 'Israel': 'XTAE', 'Italy': 'MTAA', 'Japan': 'XTKS', 'Jordan': 'XAMM', 'Kenya': 'XNAI', 'Kuwait': 'XKUW', 'Luxembourg': 'XLUX', 'Malaysia': 'XKLS', 'Mexico': 'XMEX', 'Morocco': 'XCAS', 'New Zealand': 'XNZE', 'Nigeria': 'XNSA', 'Norway': 'XOSL', 'Norway_NOTC': 'NOTC', 'Oman': 'XMUS', 'Pakistan': 'XKAR', 'Peru': 'XLIM', 'Philippines': 'XPHS', 'Poland': 'XWAR', 'Portugal': 'XLIS', 'Qatar': 'DSMD', 'Romania': 'XBSE', 'Russia': 'MISX', 'Saudi Arabia': 'XSAU', 'Senegal': 'XBRV', 'Singapore': 'XSES', 'Slovenia': 'XLJU', 'South Africa': 'XJSE', 'South Korea': 'XKRX', 'South Korea_XKOS': 'XKOS', 'Spain': 'XMAD', 'Sri Lanka': 'XCOL', 'Sweden_XNGM': 'XNGM', 'Sweden': 'XSTO', 'Switzerland': 'XSWX', 'Switzerland_XVTX': 'XVTX', 'Syria': 'XDSE', 'Taiwan': 'XTAI', 'Thailand': 'XBKK', 'The Netherlands_XTOMX': 'TOMX', 'The Netherlands': 'XAMS', 'Turkey': 'XIST', 'United Arab Emirates_XDFM': 'XDFM', 'United Arab Emirates_DIFX': 'DIFX', 'United Arab Emirates': 'XADS', 'United Kingdom_BATE': 'BATE', 'United Kingdom_CHIX': 'CHIX', 'United Kingdom': 'XLON', 'United Kingdom_XPOS': 'XPOS', 'United Kingdom_TRQX': 'TRQX', 'United Kingdom_BOAT': 'BOAT', 'USA_XASE': 'XASE', 'USA_BATS': 'BATS', 'USA_XNYS': 'XNYS', 'USA_ARCX': 'ARCX', 'USA_XNMS': 'XNMS', 'USA_XNCM': 'XNCM', 'USA_OOTC': 'OOTC', 'USA_XNGS': 'XNGS', 'USA': None, 'Vietnam': 'XSTC', 'Vietnam_HSTC': 'HSTC' } currencies = [ 'ALL', 'AFN', 'ARS', 'AWG', 'AUD', 'AZN', 'BSD', 'BBD', 'BYN', 'BZD', 'BMD', 'BOB', 'BAM', 'BWP', 'BGN', 'BRL', 'BND', 'KHR', 'CAD', 'KYD', 'CLP', 'CNY', 'COP', 'CRC', 'HRK', 'CUP', 'CZK', 'DKK', 'DOP', 'XCD', 'EGP', 'SVC', 'EUR', 'FKP', 'FJD', 'GHS', 'GIP', 'GTQ', 'GGP', 'GYD', 'HNL', 'HKD', 'HUF', 'ISK', 'INR', 'IDR', 'IRR', 'IMP', 'ILS', 'JMD', 'JPY', 'JEP', 'KZT', 'KPW', 'KRW', 'KGS', 'LAK', 'LBP', 'LRD', 'MKD', 'MYR', 'MUR', 'MXN', 'MNT', 'MZN', 'NAD', 'NPR', 'ANG', 'NZD', 'NIO', 'NGN', 'NOK', 'OMR', 'PKR', 'PAB', 'PYG', 'PEN', 'PHP', 'PLN', 'QAR', 'RON', 'RUB', 'SHP', 'SAR', 'RSD', 'SCR', 'SGD', 'SBD', 'SOS', 'ZAR', 'LKR', 'SEK', 'CHF', 'SRD', 'SYP', 'TWD', 'THB', 'TTD', 'TRY', 'TVD', 'UAH', 'GBP', 'USD', 'UYU', 'UZS', 'VEF', 'VND', 'YER', 'ZWD' ]
exchanges = {'USA': None, 'Germany': 'XETR', 'Hong Kong': 'XHKG', 'Japan': 'XTKS', 'France': 'XPAR', 'Canada': 'XTSE', 'United Kingdom': 'XLON', 'Switzerland': 'XSWX', 'Australia': 'XASX', 'South Korea': 'XKRX', 'The Netherlands': 'XAMS', 'Spain': 'XMAD', 'Russia': 'MISX', 'Italy': 'XMIL', 'Belgium': 'XBRU', 'Mexiko': 'XMEX', 'Sweden': 'XSTO', 'Norway': 'XOSL', 'Finland': 'XHEL', 'Denmark': 'XCSE', 'Austria': 'XWBO'} exchanges_untested = {'Argentina': 'XBUE', 'Australia_XNEC': 'XNEC', 'Australia': 'XASX', 'Austria': 'XWBO', 'Bahrain': 'XBAH', 'Bangladesh': 'XDHA', 'Belgium': 'XBRU', 'Brazil': 'BVMF', 'Canada_XCNQ': 'XCNQ', 'Canada': 'XTSE', 'Canada_XTSX': 'XTSX', 'Canada_NEOE': 'NEOE', 'Chile': 'XSGO', 'China_SHG': 'XSHG', 'China': 'XSHE', 'Colombia': 'XBOG', 'Croatia': 'XZAG', 'Cyprus': 'XCYS', 'Czech Republic': 'XPRA', 'Denmark': 'XCSE', 'Egypt': 'XCAI', 'Finland': 'XHEL', 'France': 'XPAR', 'Germany_XEQT': 'XEQT', 'Germany_XBER': 'XBER', 'Germany_XDUS': 'XDUS', 'Germany_XFRA': 'XFRA', 'Germany_XMUN': 'XMUN', 'Germany_XSTU': 'XSTU', 'Germany': 'XETR', 'Germany_XQTX': 'XQTX', 'Greece': 'XATH', 'Hong Kong': 'XHKG', 'Hungary': 'XBUD', 'Iceland': 'XICE', 'India_XBOM': 'XBOM', 'India': 'XNSE', 'Indonesia': 'XIDX', 'Ireland': 'XDUB', 'Israel': 'XTAE', 'Italy': 'MTAA', 'Japan': 'XTKS', 'Jordan': 'XAMM', 'Kenya': 'XNAI', 'Kuwait': 'XKUW', 'Luxembourg': 'XLUX', 'Malaysia': 'XKLS', 'Mexico': 'XMEX', 'Morocco': 'XCAS', 'New Zealand': 'XNZE', 'Nigeria': 'XNSA', 'Norway': 'XOSL', 'Norway_NOTC': 'NOTC', 'Oman': 'XMUS', 'Pakistan': 'XKAR', 'Peru': 'XLIM', 'Philippines': 'XPHS', 'Poland': 'XWAR', 'Portugal': 'XLIS', 'Qatar': 'DSMD', 'Romania': 'XBSE', 'Russia': 'MISX', 'Saudi Arabia': 'XSAU', 'Senegal': 'XBRV', 'Singapore': 'XSES', 'Slovenia': 'XLJU', 'South Africa': 'XJSE', 'South Korea': 'XKRX', 'South Korea_XKOS': 'XKOS', 'Spain': 'XMAD', 'Sri Lanka': 'XCOL', 'Sweden_XNGM': 'XNGM', 'Sweden': 'XSTO', 'Switzerland': 'XSWX', 'Switzerland_XVTX': 'XVTX', 'Syria': 'XDSE', 'Taiwan': 'XTAI', 'Thailand': 'XBKK', 'The Netherlands_XTOMX': 'TOMX', 'The Netherlands': 'XAMS', 'Turkey': 'XIST', 'United Arab Emirates_XDFM': 'XDFM', 'United Arab Emirates_DIFX': 'DIFX', 'United Arab Emirates': 'XADS', 'United Kingdom_BATE': 'BATE', 'United Kingdom_CHIX': 'CHIX', 'United Kingdom': 'XLON', 'United Kingdom_XPOS': 'XPOS', 'United Kingdom_TRQX': 'TRQX', 'United Kingdom_BOAT': 'BOAT', 'USA_XASE': 'XASE', 'USA_BATS': 'BATS', 'USA_XNYS': 'XNYS', 'USA_ARCX': 'ARCX', 'USA_XNMS': 'XNMS', 'USA_XNCM': 'XNCM', 'USA_OOTC': 'OOTC', 'USA_XNGS': 'XNGS', 'USA': None, 'Vietnam': 'XSTC', 'Vietnam_HSTC': 'HSTC'} currencies = ['ALL', 'AFN', 'ARS', 'AWG', 'AUD', 'AZN', 'BSD', 'BBD', 'BYN', 'BZD', 'BMD', 'BOB', 'BAM', 'BWP', 'BGN', 'BRL', 'BND', 'KHR', 'CAD', 'KYD', 'CLP', 'CNY', 'COP', 'CRC', 'HRK', 'CUP', 'CZK', 'DKK', 'DOP', 'XCD', 'EGP', 'SVC', 'EUR', 'FKP', 'FJD', 'GHS', 'GIP', 'GTQ', 'GGP', 'GYD', 'HNL', 'HKD', 'HUF', 'ISK', 'INR', 'IDR', 'IRR', 'IMP', 'ILS', 'JMD', 'JPY', 'JEP', 'KZT', 'KPW', 'KRW', 'KGS', 'LAK', 'LBP', 'LRD', 'MKD', 'MYR', 'MUR', 'MXN', 'MNT', 'MZN', 'NAD', 'NPR', 'ANG', 'NZD', 'NIO', 'NGN', 'NOK', 'OMR', 'PKR', 'PAB', 'PYG', 'PEN', 'PHP', 'PLN', 'QAR', 'RON', 'RUB', 'SHP', 'SAR', 'RSD', 'SCR', 'SGD', 'SBD', 'SOS', 'ZAR', 'LKR', 'SEK', 'CHF', 'SRD', 'SYP', 'TWD', 'THB', 'TTD', 'TRY', 'TVD', 'UAH', 'GBP', 'USD', 'UYU', 'UZS', 'VEF', 'VND', 'YER', 'ZWD']
def SC_DFA(y): N = len(y) tau = int(np.floor(N/2)) y = y - np.mean(y) x = np.cumsum(y) taus = np.arange(5,tau+1) ntau = len(taus) F = np.zeros(ntau) for i in range(ntau): t = int(taus[i]) x_buff = x[:N - N % t] x_buff = x_buff.reshape((int(N / t),t)) y_buff = np.zeros((int(N / t),t)) for j in range(int(N / t)): tt = range(0,int(t)) p = np.polyfit(tt,x_buff[j,:],1) y_buff[j,:] = np.power(x_buff[j,:] - np.polyval(p,tt),2) y_buff.reshape((N - N % t,1)) F[i] = np.sqrt(np.mean(y_buff)) logtaur = np.log(taus) logF = np.log(F) p = np.polyfit(logtaur,logF,1) return p[0]
def sc_dfa(y): n = len(y) tau = int(np.floor(N / 2)) y = y - np.mean(y) x = np.cumsum(y) taus = np.arange(5, tau + 1) ntau = len(taus) f = np.zeros(ntau) for i in range(ntau): t = int(taus[i]) x_buff = x[:N - N % t] x_buff = x_buff.reshape((int(N / t), t)) y_buff = np.zeros((int(N / t), t)) for j in range(int(N / t)): tt = range(0, int(t)) p = np.polyfit(tt, x_buff[j, :], 1) y_buff[j, :] = np.power(x_buff[j, :] - np.polyval(p, tt), 2) y_buff.reshape((N - N % t, 1)) F[i] = np.sqrt(np.mean(y_buff)) logtaur = np.log(taus) log_f = np.log(F) p = np.polyfit(logtaur, logF, 1) return p[0]
''' Formula for area of circle Area = pi * r^2 where pi is constant and r is the radius of the circle ''' def findarea(r): PI = 3.142 return PI * (r*r); print("Area is %.6f" % findarea(5));
""" Formula for area of circle Area = pi * r^2 where pi is constant and r is the radius of the circle """ def findarea(r): pi = 3.142 return PI * (r * r) print('Area is %.6f' % findarea(5))
class Take(object): def __init__(self, stage, unit, entity, not_found_proc, finished_proc): self._stage = stage self._unit = unit self._entity = entity self._finished_proc = finished_proc self._not_found_proc = not_found_proc def enact(self): if not self._entity.location \ or self._entity.location != (self._unit.x, self._unit.y): self._not_found_proc() return self._entity.location = None self._stage.delete_entity(self._entity) self._finished_proc() return
class Take(object): def __init__(self, stage, unit, entity, not_found_proc, finished_proc): self._stage = stage self._unit = unit self._entity = entity self._finished_proc = finished_proc self._not_found_proc = not_found_proc def enact(self): if not self._entity.location or self._entity.location != (self._unit.x, self._unit.y): self._not_found_proc() return self._entity.location = None self._stage.delete_entity(self._entity) self._finished_proc() return
rows = [] with open("C:\\Privat\\advent_of_code20\\puzzle14\\input1.txt") as f: for line in f: rows.append(line.strip()) #print(rows) memory = {} currentMask = "" for line in rows: split = line.split(' = ') if 'mask' in split[0]: currentMask = split[1].strip() else: # value in bit bit = format(int(split[1]), '036b') # bit through mask maskl = len(currentMask) bitl = len(bit) result = '' #print(bit) #print(currentMask) for i in range(0, len(bit)): maskBit = currentMask[i] bitBit = bit[i] if maskBit != 'X': result += maskBit else: result += bitBit #print(result) toWrite = int(result, 2) # replace in memory memoryPosition = split[0][4:-1] if not memoryPosition in memory: memory[memoryPosition] = 0 memory[memoryPosition] = toWrite #print(memory) sum = 0 for key in memory: sum += memory[key] print("Sum of all values in memory: " + str(sum))
rows = [] with open('C:\\Privat\\advent_of_code20\\puzzle14\\input1.txt') as f: for line in f: rows.append(line.strip()) memory = {} current_mask = '' for line in rows: split = line.split(' = ') if 'mask' in split[0]: current_mask = split[1].strip() else: bit = format(int(split[1]), '036b') maskl = len(currentMask) bitl = len(bit) result = '' for i in range(0, len(bit)): mask_bit = currentMask[i] bit_bit = bit[i] if maskBit != 'X': result += maskBit else: result += bitBit to_write = int(result, 2) memory_position = split[0][4:-1] if not memoryPosition in memory: memory[memoryPosition] = 0 memory[memoryPosition] = toWrite sum = 0 for key in memory: sum += memory[key] print('Sum of all values in memory: ' + str(sum))
startHTML = ''' <html> <head> <style> table { border-collapse: collapse; height: 100%; width: 100%; } table, th, td { border: 3px solid black; } @media print { table { page-break-after: always; } } .cutoffs td { border: 0; font-weight: bold; } .compName { font-size: 48pt; font-weight: bold; } .labels { font-size: 24pt; font-weight: bold; } .attempt { font-size: 36pt; font-weight: bold; text-align: center; } .event, .personID, .scrambler { font-size: 24pt; font-weight: bold; width: 60px; } .round, .heat { font-size: 24pt; font-weight: bold; } .personName { font-size: 40pt; font-weight: bold; } .attemptNumber { width: 60px; } .initial { width: 100px; } </style> </head> <body> ''' ao5Table = ''' <table> <tr> <th colspan="6" class="compName">competitionName</th> </tr> <tr> <th colspan="1" class="personID">competitorID</th> <th colspan="3" class="event">eventName</th> <th colspan="1" class="heat">G: heatNumber</th> <th colspan="1" class="round">R: roundNumber</th> </tr> <tr> <th colspan="6" class="personName">competitorName</th> </tr> <tr class="labels"> <th colspan="1" class="scrambler">Scr</th> <th colspan="1" class="attemptNumber">#</th> <th colspan="2">Results</th> <th colspan="1" class="initial">Judge</th> <th colspan="1" class="initial">Comp</th> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">1</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">2</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="cutoffs"> <td colspan="1"></td> <td colspan="1"></td> <td colspan="1">Cutoff: cutoffTime</td> <td colspan="1">Time Limit: timeLimit</td> <td colspan="1"></td> <td colspan="1"></td> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">3</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">4</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">5</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="empty"> <td colspan="6"></td> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">E</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> </table> ''' mo3Table = ''' <table> <tr> <th colspan="6" class="compName">competitionName</th> </tr> <tr> <th colspan="1" class="personID">competitorID</th> <th colspan="3" class="event">eventName</th> <th colspan="1" class="heat">G: heatNumber</th> <th colspan="1" class="round">R: roundNumber</th> </tr> <tr> <th colspan="6" class="personName">competitorName</th> </tr> <tr class="labels"> <th colspan="1" class="scrambler">Scr</th> <th colspan="1" class="attemptNumber">#</th> <th colspan="2">Results</th> <th colspan="1" class="initial">Judge</th> <th colspan="1" class="initial">Comp</th> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">1</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="cutoffs"> <td colspan="1"></td> <td colspan="1"></td> <td colspan="1">Cutoff: cutoffTime</td> <td colspan="1">Time Limit: timeLimit</td> <td colspan="1"></td> <td colspan="1"></td> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">2</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">3</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> <tr class="empty"> <td colspan="6"></td> </tr> <tr class="attempt"> <td colspan="1"> </td> <td colspan="1">E</td> <td colspan="2"> </td> <td colspan="1"> </td> <td colspan="1"> </td> </tr> </table> ''' endHTML = ''' </body> </html> '''
start_html = '\n <html>\n <head>\n <style>\n table {\n border-collapse: collapse;\n height: 100%;\n width: 100%;\n }\n\n table, th, td {\n border: 3px solid black;\n }\n\n @media print {\n table {\n page-break-after: always;\n }\n }\n\n .cutoffs td {\n border: 0;\n font-weight: bold;\n }\n\n .compName {\n font-size: 48pt;\n font-weight: bold;\n }\n\n .labels {\n font-size: 24pt;\n font-weight: bold;\n }\n\n .attempt {\n font-size: 36pt;\n font-weight: bold;\n text-align: center;\n }\n\n .event, .personID, .scrambler {\n font-size: 24pt;\n font-weight: bold;\n width: 60px;\n }\n\n .round, .heat {\n font-size: 24pt;\n font-weight: bold;\n }\n\n .personName {\n font-size: 40pt;\n font-weight: bold;\n }\n\n .attemptNumber {\n width: 60px;\n }\n\n .initial {\n width: 100px;\n }\n </style>\n </head>\n <body>\n' ao5_table = '\n <table>\n <tr>\n <th colspan="6" class="compName">competitionName</th>\n </tr>\n <tr>\n <th colspan="1" class="personID">competitorID</th>\n <th colspan="3" class="event">eventName</th>\n <th colspan="1" class="heat">G: heatNumber</th>\n <th colspan="1" class="round">R: roundNumber</th>\n </tr>\n <tr>\n <th colspan="6" class="personName">competitorName</th>\n </tr>\n <tr class="labels">\n <th colspan="1" class="scrambler">Scr</th>\n <th colspan="1" class="attemptNumber">#</th>\n <th colspan="2">Results</th>\n <th colspan="1" class="initial">Judge</th>\n <th colspan="1" class="initial">Comp</th>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">1</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">2</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="cutoffs">\n <td colspan="1"></td>\n <td colspan="1"></td>\n <td colspan="1">Cutoff: cutoffTime</td>\n <td colspan="1">Time Limit: timeLimit</td>\n <td colspan="1"></td>\n <td colspan="1"></td>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">3</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">4</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">5</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="empty">\n <td colspan="6"></td>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">E</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n </table>\n' mo3_table = '\n <table>\n <tr>\n <th colspan="6" class="compName">competitionName</th>\n </tr>\n <tr>\n <th colspan="1" class="personID">competitorID</th>\n <th colspan="3" class="event">eventName</th>\n <th colspan="1" class="heat">G: heatNumber</th>\n <th colspan="1" class="round">R: roundNumber</th>\n </tr>\n <tr>\n <th colspan="6" class="personName">competitorName</th>\n </tr>\n <tr class="labels">\n <th colspan="1" class="scrambler">Scr</th>\n <th colspan="1" class="attemptNumber">#</th>\n <th colspan="2">Results</th>\n <th colspan="1" class="initial">Judge</th>\n <th colspan="1" class="initial">Comp</th>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">1</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="cutoffs">\n <td colspan="1"></td>\n <td colspan="1"></td>\n <td colspan="1">Cutoff: cutoffTime</td>\n <td colspan="1">Time Limit: timeLimit</td>\n <td colspan="1"></td>\n <td colspan="1"></td>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">2</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">3</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n <tr class="empty">\n <td colspan="6"></td>\n </tr>\n <tr class="attempt">\n <td colspan="1"> </td>\n <td colspan="1">E</td>\n <td colspan="2"> </td>\n <td colspan="1"> </td>\n <td colspan="1"> </td>\n </tr>\n </table>\n' end_html = '\n </body>\n </html>\n'
# Use snippet 'summarize_a_survey_module' to output a table and a graph of # participant counts by response for one question_concept_id # The snippet assumes that a dataframe containing survey questions and answers already exists # The snippet also assumes that setup has been run # Update the next 3 lines survey_df = YOUR_DATASET_NAME_survey_df question_concept_id = 1585940 denominator = None # e.g: 200000 #################################################################################### # DON'T CHANGE FROM HERE #################################################################################### def summarize_a_question_concept_id(df, question_concept_id, denominator=None): df = df.loc[df['question_concept_id'] == question_concept_id].copy() new_df = df.groupby(['answer_concept_id', 'answer'])['person_id']\ .nunique()\ .reset_index()\ .rename(columns=dict(person_id='n_participant'))\ .assign(answer_concept_id = lambda x: np.int32(x.answer_concept_id)) if denominator: new_df['response_rate'] = round(100*new_df['n_participant']/denominator,2) if question_concept_id in df['question_concept_id'].unique(): print(f"Distribution of response to {df.loc[df['question_concept_id'] == question_concept_id, 'question'].unique()[0]}") # show table display(new_df) # show graph display(ggplot(data=new_df) + geom_bar(aes(x='answer', y='n_participant'), stat='identity') + coord_flip() + labs(y="Participant count", x="") + theme_bw()) else: print("There is an error with your question_concept_id") summarize_a_question_concept_id(survey_df, question_concept_id, denominator)
survey_df = YOUR_DATASET_NAME_survey_df question_concept_id = 1585940 denominator = None def summarize_a_question_concept_id(df, question_concept_id, denominator=None): df = df.loc[df['question_concept_id'] == question_concept_id].copy() new_df = df.groupby(['answer_concept_id', 'answer'])['person_id'].nunique().reset_index().rename(columns=dict(person_id='n_participant')).assign(answer_concept_id=lambda x: np.int32(x.answer_concept_id)) if denominator: new_df['response_rate'] = round(100 * new_df['n_participant'] / denominator, 2) if question_concept_id in df['question_concept_id'].unique(): print(f"Distribution of response to {df.loc[df['question_concept_id'] == question_concept_id, 'question'].unique()[0]}") display(new_df) display(ggplot(data=new_df) + geom_bar(aes(x='answer', y='n_participant'), stat='identity') + coord_flip() + labs(y='Participant count', x='') + theme_bw()) else: print('There is an error with your question_concept_id') summarize_a_question_concept_id(survey_df, question_concept_id, denominator)
class LOG: def info(message): print("Info: " + message) def error(message): print("Error: " + message) def debug(message): print("Debug: " + message)
class Log: def info(message): print('Info: ' + message) def error(message): print('Error: ' + message) def debug(message): print('Debug: ' + message)
if __name__ == '__main__': # Fill in the code to do the following # 1. Set x to be a non-negative integer (no decimals, no negatives) # 2. If x is divisible by 3, print 'Fizz' # 3. If x is divisible by 5, print 'Buzz' # 4. If x is divisible by both 3 and 5, print 'FizzBuzz' # 5. If x is divisible by neither 3 nor 5, do not print anything # # How to check if a number is divisble by another number? # Use modulus division! Modulus division tells you what the # remainder is after you do as many divisions as you can. It is performed # with the % operator. # # For example, 7 / 4 = 1 with 3 remaining. Modulus division will return # 3 for this example, that is, 7 % 4, will return 3. If a number is x is # divisible by another number y, x % y will be 0. So, 4 % 2 = 0. # Change assignment here x = 1 # Insert conditional(s) here
if __name__ == '__main__': x = 1
class Solution: def rotate(self, matrix) -> None: result = [] for i in range(0,len(matrix)): store = [] for j in range(len(matrix)-1,-1,-1): store.append(matrix[j][i]) result.append(store) for i in range(0,len(result)): matrix[i] = result[i] return matrix a = Solution() print(a.rotate([[1,2],[3,4]]))
class Solution: def rotate(self, matrix) -> None: result = [] for i in range(0, len(matrix)): store = [] for j in range(len(matrix) - 1, -1, -1): store.append(matrix[j][i]) result.append(store) for i in range(0, len(result)): matrix[i] = result[i] return matrix a = solution() print(a.rotate([[1, 2], [3, 4]]))
provinces = [ # ["nunavut", 2], # ["yukon", 4], # ["Northwest%20Territories",2], # ["Prince%20Edward%20Island", 6], # ["Newfoundland%20and%20Labrador", 12], # ["New%20Brunswick", 28], # ["Nova%20Scotia", 36], # ["Saskatchewan", 34], # ["Manitoba", 40], # ["Alberta", 167], # ["British%20Columbia", 307], # ["quebec", 407], ["ontario", 1000], # ["calgary", 811], ]
provinces = [['ontario', 1000]]
class Estrella: def __init__(self,galaxia ="none",temperatura = 0,masa = 0): self.galaxia = galaxia self.temperatura = temperatura self.masa = masa
class Estrella: def __init__(self, galaxia='none', temperatura=0, masa=0): self.galaxia = galaxia self.temperatura = temperatura self.masa = masa
L = int(input()) Tot = 0 Med = 0 T = str(input()).upper() M = [[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0]] for i in range(12): for j in range(12): M[i][j] = float(input()) for j in range(12): Tot =+ M[L][j] Med = Tot/12 if T == "M": print('{:.1f}'.format(Med)) else: print('{:.1f}'.format(Tot))
l = int(input()) tot = 0 med = 0 t = str(input()).upper() m = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] for i in range(12): for j in range(12): M[i][j] = float(input()) for j in range(12): tot = +M[L][j] med = Tot / 12 if T == 'M': print('{:.1f}'.format(Med)) else: print('{:.1f}'.format(Tot))
######################### # DO NOT MODIFY ######################### # SETTINGS.INI C_MAIN_SETTINGS = 'Main_Settings' P_DIR_IGNORE = 'IgnoreDirectories' P_FILE_IGNORE = 'IgnoreFiles' P_SRC_DIR = 'SourceDirectory' P_DEST_DIR = 'DestinationDirectories' P_BATCH_SIZE = 'BatchProcessingGroupSize' P_FILE_BUFFER = 'FileReadBuffer' P_SERVER_IP = 'SFTPServerIP' P_SERVER_PORT = 'SFTPServerPort' # SUPPORTED HASHES H_SHA_256 = 'sha256' H_SHA_224 = 'sha224' H_SHA_384 = 'sha384' H_SHA_512 = 'sha512' H_SHA_1 = 'sha1' H_MD5 = 'md5' H_CRC_32 = 'crc32' H_ADLER_32 = 'adler32'
c_main_settings = 'Main_Settings' p_dir_ignore = 'IgnoreDirectories' p_file_ignore = 'IgnoreFiles' p_src_dir = 'SourceDirectory' p_dest_dir = 'DestinationDirectories' p_batch_size = 'BatchProcessingGroupSize' p_file_buffer = 'FileReadBuffer' p_server_ip = 'SFTPServerIP' p_server_port = 'SFTPServerPort' h_sha_256 = 'sha256' h_sha_224 = 'sha224' h_sha_384 = 'sha384' h_sha_512 = 'sha512' h_sha_1 = 'sha1' h_md5 = 'md5' h_crc_32 = 'crc32' h_adler_32 = 'adler32'
def bubble_sort(iterable): return sorted(iterable) def selection_sort(iterable): return sorted(iterable) def insertion_sort(iterable): return sorted(iterable) def merge_sort(iterable): return sorted(iterable) def quicksort(iterable): return sorted(iterable)
def bubble_sort(iterable): return sorted(iterable) def selection_sort(iterable): return sorted(iterable) def insertion_sort(iterable): return sorted(iterable) def merge_sort(iterable): return sorted(iterable) def quicksort(iterable): return sorted(iterable)
class Author: @property def surname(self): return self._surname @property def firstname(self): return self._firstname @property def affiliation(self): return self._affiliation @property def identifier(self): return self._identifier @firstname.setter def firstname(self, firstname): self._firstname = firstname @affiliation.setter def affiliation(self, affiliation): self._affiliation = affiliation @identifier.setter def identifier(self, identifier): self._identifier = identifier def __init__(self, surname, firstname='', affiliation=None, identifier=None): self._surname = surname self._firstname = firstname if affiliation is not None: self._affiliation = affiliation else: self._affiliation = [] if identifier is not None: self._identifier = identifier else: self._identifier = [] def to_output(self): string = self._surname + "," + self._firstname + " (" try: for affil in self._affiliation: string += affil["name"].replace(";", " ") string += ", " except: print("no affiliation given") string += "), " return string
class Author: @property def surname(self): return self._surname @property def firstname(self): return self._firstname @property def affiliation(self): return self._affiliation @property def identifier(self): return self._identifier @firstname.setter def firstname(self, firstname): self._firstname = firstname @affiliation.setter def affiliation(self, affiliation): self._affiliation = affiliation @identifier.setter def identifier(self, identifier): self._identifier = identifier def __init__(self, surname, firstname='', affiliation=None, identifier=None): self._surname = surname self._firstname = firstname if affiliation is not None: self._affiliation = affiliation else: self._affiliation = [] if identifier is not None: self._identifier = identifier else: self._identifier = [] def to_output(self): string = self._surname + ',' + self._firstname + ' (' try: for affil in self._affiliation: string += affil['name'].replace(';', ' ') string += ', ' except: print('no affiliation given') string += '), ' return string
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Jon Hawkesworth (@jhawkesworth) <jhawkesworth@protonmail.com> # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r''' --- module: win_toast short_description: Sends Toast windows notification to logged in users on Windows 10 or later hosts description: - Sends alerts which appear in the Action Center area of the windows desktop. options: expire: description: - How long in seconds before the notification expires. type: int default: 45 group: description: - Which notification group to add the notification to. type: str default: Powershell msg: description: - The message to appear inside the notification. - May include \n to format the message to appear within the Action Center. type: str default: Hello, World! popup: description: - If C(no), the notification will not pop up and will only appear in the Action Center. type: bool default: yes tag: description: - The tag to add to the notification. type: str default: Ansible title: description: - The notification title, which appears in the pop up.. type: str default: Notification HH:mm notes: - This module must run on a windows 10 or Server 2016 host, so ensure your play targets windows hosts, or delegates to a windows host. - The module does not fail if there are no logged in users to notify. - Messages are only sent to the local host where the module is run. - You must run this module with async, otherwise it will hang until the expire period has passed. seealso: - module: community.windows.win_msg - module: community.windows.win_say author: - Jon Hawkesworth (@jhawkesworth) ''' EXAMPLES = r''' - name: Warn logged in users of impending upgrade (note use of async to stop the module from waiting until notification expires). community.windows.win_toast: expire: 60 title: System Upgrade Notification msg: Automated upgrade about to start. Please save your work and log off before {{ deployment_start_time }} async: 60 poll: 0 ''' RETURN = r''' expire_at_utc: description: Calculated utc date time when the notification expires. returned: always type: str sample: 07 July 2017 04:50:54 no_toast_sent_reason: description: Text containing the reason why a notification was not sent. returned: when no logged in users are detected type: str sample: No logged in users to notify sent_localtime: description: local date time when the notification was sent. returned: always type: str sample: 07 July 2017 05:45:54 time_taken: description: How long the module took to run on the remote windows host in seconds. returned: always type: float sample: 0.3706631999999997 toast_sent: description: Whether the module was able to send a toast notification or not. returned: always type: bool sample: false '''
documentation = '\n---\nmodule: win_toast\nshort_description: Sends Toast windows notification to logged in users on Windows 10 or later hosts\ndescription:\n - Sends alerts which appear in the Action Center area of the windows desktop.\noptions:\n expire:\n description:\n - How long in seconds before the notification expires.\n type: int\n default: 45\n group:\n description:\n - Which notification group to add the notification to.\n type: str\n default: Powershell\n msg:\n description:\n - The message to appear inside the notification.\n - May include \\n to format the message to appear within the Action Center.\n type: str\n default: Hello, World!\n popup:\n description:\n - If C(no), the notification will not pop up and will only appear in the Action Center.\n type: bool\n default: yes\n tag:\n description:\n - The tag to add to the notification.\n type: str\n default: Ansible\n title:\n description:\n - The notification title, which appears in the pop up..\n type: str\n default: Notification HH:mm\nnotes:\n - This module must run on a windows 10 or Server 2016 host, so ensure your play targets windows hosts, or delegates to a windows host.\n - The module does not fail if there are no logged in users to notify.\n - Messages are only sent to the local host where the module is run.\n - You must run this module with async, otherwise it will hang until the expire period has passed.\nseealso:\n- module: community.windows.win_msg\n- module: community.windows.win_say\nauthor:\n- Jon Hawkesworth (@jhawkesworth)\n' examples = '\n- name: Warn logged in users of impending upgrade (note use of async to stop the module from waiting until notification expires).\n community.windows.win_toast:\n expire: 60\n title: System Upgrade Notification\n msg: Automated upgrade about to start. Please save your work and log off before {{ deployment_start_time }}\n async: 60\n poll: 0\n' return = '\nexpire_at_utc:\n description: Calculated utc date time when the notification expires.\n returned: always\n type: str\n sample: 07 July 2017 04:50:54\nno_toast_sent_reason:\n description: Text containing the reason why a notification was not sent.\n returned: when no logged in users are detected\n type: str\n sample: No logged in users to notify\nsent_localtime:\n description: local date time when the notification was sent.\n returned: always\n type: str\n sample: 07 July 2017 05:45:54\ntime_taken:\n description: How long the module took to run on the remote windows host in seconds.\n returned: always\n type: float\n sample: 0.3706631999999997\ntoast_sent:\n description: Whether the module was able to send a toast notification or not.\n returned: always\n type: bool\n sample: false\n'
VERSION = "1.4.4" if __name__ == "__main__": print(VERSION, end="")
version = '1.4.4' if __name__ == '__main__': print(VERSION, end='')
party_size = int(input()) days = int(input()) total_coins = 0 for day in range (1, days + 1): if day % 10 == 0: party_size -= 2 if day % 15 == 0: party_size += 5 total_coins += (50 - (2 * party_size)) if day % 3 == 0: total_coins -= (3 * party_size) if day % 5 == 0: total_coins += (20 * party_size) if day % 3 == 0 and day % 5 == 0: total_coins -= (2 * party_size) print(f'{party_size} companions received {int(total_coins/party_size)} coins each.')
party_size = int(input()) days = int(input()) total_coins = 0 for day in range(1, days + 1): if day % 10 == 0: party_size -= 2 if day % 15 == 0: party_size += 5 total_coins += 50 - 2 * party_size if day % 3 == 0: total_coins -= 3 * party_size if day % 5 == 0: total_coins += 20 * party_size if day % 3 == 0 and day % 5 == 0: total_coins -= 2 * party_size print(f'{party_size} companions received {int(total_coins / party_size)} coins each.')
#break for i in range(1,10,1): if(i==5): continue print(i)
for i in range(1, 10, 1): if i == 5: continue print(i)
@bot.on(events.NewMessage(incoming=True)) @bot.on(events.MessageEdited(incoming=True)) async def common_incoming_handler(e): if SPAM: db=sqlite3.connect("spam_mute.db") cursor=db.cursor() cursor.execute('''SELECT * FROM SPAM''') all_rows = cursor.fetchall() for row in all_rows: if int(row[0]) == int(e.chat_id): if int(row[1]) == int(e.sender_id): await e.delete() return db=sqlite3.connect("spam_mute.db") cursor=db.cursor() cursor.execute('''SELECT * FROM MUTE''') all_rows = cursor.fetchall() for row in all_rows: if int(row[0]) == int(e.chat_id): if int(row[1]) == int(e.sender_id): await e.delete() return if e.sender_id not in MUTING_USERS: MUTING_USERS={} MUTING_USERS.update({e.sender_id:1}) if e.sender_id in MUTING_USERS: MUTING_USERS[e.sender_id]=MUTING_USERS[e.sender_id]+1 if MUTING_USERS[e.sender_id]>SPAM_ALLOWANCE: db=sqlite3.connect("spam_mute.db") cursor=db.cursor() cursor.execute('''INSERT INTO SPAM VALUES(?,?)''', (int(e.chat_id),int(e.sender_id))) db.commit() db.close() await bot.send_message(e.chat_id,"`Spammer Nibba was muted.`") return if e.chat_id > 0: await bot.send_message(e.chat_id,"`I am not trained to deal with people spamming on PM.") @bot.on(events.NewMessage(outgoing=True, pattern='.asmoff')) @bot.on(events.MessageEdited(outgoing=True, pattern='.asmoff')) async def set_asm(e): global SPAM SPAM=False await e.edit("Spam Tracking turned off!") db=sqlite3.connect("spam_mute.db") cursor=db.cursor() cursor.execute('''DELETE FROM SPAM WHERE chat_id<0''') db.commit() db.close() @bot.on(events.NewMessage(outgoing=True, pattern='.asmon')) @bot.on(events.MessageEdited(outgoing=True, pattern='.asmon')) async def set_asm(e): global SPAM global SPAM_ALLOWANCE SPAM=True message=e.text SPAM_ALLOWANCE=int(message[6:]) await e.edit("Spam Tracking turned on!") await bot.send_message(LOGGER_GROUP,"Spam Tracking is Turned on!")
@bot.on(events.NewMessage(incoming=True)) @bot.on(events.MessageEdited(incoming=True)) async def common_incoming_handler(e): if SPAM: db = sqlite3.connect('spam_mute.db') cursor = db.cursor() cursor.execute('SELECT * FROM SPAM') all_rows = cursor.fetchall() for row in all_rows: if int(row[0]) == int(e.chat_id): if int(row[1]) == int(e.sender_id): await e.delete() return db = sqlite3.connect('spam_mute.db') cursor = db.cursor() cursor.execute('SELECT * FROM MUTE') all_rows = cursor.fetchall() for row in all_rows: if int(row[0]) == int(e.chat_id): if int(row[1]) == int(e.sender_id): await e.delete() return if e.sender_id not in MUTING_USERS: muting_users = {} MUTING_USERS.update({e.sender_id: 1}) if e.sender_id in MUTING_USERS: MUTING_USERS[e.sender_id] = MUTING_USERS[e.sender_id] + 1 if MUTING_USERS[e.sender_id] > SPAM_ALLOWANCE: db = sqlite3.connect('spam_mute.db') cursor = db.cursor() cursor.execute('INSERT INTO SPAM VALUES(?,?)', (int(e.chat_id), int(e.sender_id))) db.commit() db.close() await bot.send_message(e.chat_id, '`Spammer Nibba was muted.`') return if e.chat_id > 0: await bot.send_message(e.chat_id, '`I am not trained to deal with people spamming on PM.') @bot.on(events.NewMessage(outgoing=True, pattern='.asmoff')) @bot.on(events.MessageEdited(outgoing=True, pattern='.asmoff')) async def set_asm(e): global SPAM spam = False await e.edit('Spam Tracking turned off!') db = sqlite3.connect('spam_mute.db') cursor = db.cursor() cursor.execute('DELETE FROM SPAM WHERE chat_id<0') db.commit() db.close() @bot.on(events.NewMessage(outgoing=True, pattern='.asmon')) @bot.on(events.MessageEdited(outgoing=True, pattern='.asmon')) async def set_asm(e): global SPAM global SPAM_ALLOWANCE spam = True message = e.text spam_allowance = int(message[6:]) await e.edit('Spam Tracking turned on!') await bot.send_message(LOGGER_GROUP, 'Spam Tracking is Turned on!')
class ElectionFraudDiv2: def IsFraudulent(self, percentages): ra, rb = 0, 0 for p in percentages: a, b = 10001, 0 for i in xrange(10001): if int(round(i*100.0 / 10000)) == p: a, b = min(a, i), max(b, i) if not b: return 'YES' ra += a rb += b return 'NO' if ra <= 10000 <= rb else 'YES'
class Electionfrauddiv2: def is_fraudulent(self, percentages): (ra, rb) = (0, 0) for p in percentages: (a, b) = (10001, 0) for i in xrange(10001): if int(round(i * 100.0 / 10000)) == p: (a, b) = (min(a, i), max(b, i)) if not b: return 'YES' ra += a rb += b return 'NO' if ra <= 10000 <= rb else 'YES'
class Solution: def removeStones(self, stones: List[List[int]]) -> int: graph = collections.defaultdict(list) n = len(stones) for i in range(n): for j in range(n): if i == j: continue if stones[i][0] == stones[j][0] or stones[i][1] == stones[j][1]: graph[i].append(j) visited = [False]*n components = 0 for i in range(n): if visited[i]: continue components += 1 stack = [i] visited[i] = True while stack: node = stack.pop() visited[node] = True for neighbor in graph[node]: if not visited[neighbor]: stack.append(neighbor) return n - components
class Solution: def remove_stones(self, stones: List[List[int]]) -> int: graph = collections.defaultdict(list) n = len(stones) for i in range(n): for j in range(n): if i == j: continue if stones[i][0] == stones[j][0] or stones[i][1] == stones[j][1]: graph[i].append(j) visited = [False] * n components = 0 for i in range(n): if visited[i]: continue components += 1 stack = [i] visited[i] = True while stack: node = stack.pop() visited[node] = True for neighbor in graph[node]: if not visited[neighbor]: stack.append(neighbor) return n - components
''' Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ \ 7 2 1 return true, as there exist a root-to-leaf path 5->4->11->2 which sum is 22. ''' # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def dfs(self,root,csum): #if the node is leafe if root is None: #check if the cumsum equal to input if csum == self.check: return True else: return False csum += root.val #find any matches return self.dfs(root.left,csum) or self.dfs(root.right,csum) def hasPathSum(self, root: TreeNode, sum: int) -> bool: self.check = sum if not root: return False else: return self.dfs(root,0) class Solution2: def dfs(self,root,csum): #if node exist if root: #if node a leafe #if not (root.left and root.right): NOT WORKING #USE is None instead if root.left is None and root.right is None: #add value to cumsum csum += root.val #return #return True if csum ==self.check else False #is not working, == is used if csum == self.check: return True #check for children return self.dfs(root.left,csum) or self.dfs(root.right,csum) def hasPathSum(self, root: TreeNode, sum: int) -> bool: self.check = sum return self.dfs(root,0) root = TreeNode(5) root.left = TreeNode(4) root.left.left = TreeNode(11) root.left.left.left =TreeNode(7) root.left.left.right = TreeNode(2) root.right = TreeNode(8) root.right.left = TreeNode(13) root.right.right = TreeNode(4) root.right.right.right = TreeNode(1) s = Solution() s2 = Solution2() res = s.hasPathSum(root,22) res2 = s2.hasPathSum(root,22) # res = s.hasPathSum(None,0) print(res,'\n',res2)
""" Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / 4 8 / / 11 13 4 / \\ 7 2 1 return true, as there exist a root-to-leaf path 5->4->11->2 which sum is 22. """ class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def dfs(self, root, csum): if root is None: if csum == self.check: return True else: return False csum += root.val return self.dfs(root.left, csum) or self.dfs(root.right, csum) def has_path_sum(self, root: TreeNode, sum: int) -> bool: self.check = sum if not root: return False else: return self.dfs(root, 0) class Solution2: def dfs(self, root, csum): if root: if root.left is None and root.right is None: csum += root.val if csum == self.check: return True return self.dfs(root.left, csum) or self.dfs(root.right, csum) def has_path_sum(self, root: TreeNode, sum: int) -> bool: self.check = sum return self.dfs(root, 0) root = tree_node(5) root.left = tree_node(4) root.left.left = tree_node(11) root.left.left.left = tree_node(7) root.left.left.right = tree_node(2) root.right = tree_node(8) root.right.left = tree_node(13) root.right.right = tree_node(4) root.right.right.right = tree_node(1) s = solution() s2 = solution2() res = s.hasPathSum(root, 22) res2 = s2.hasPathSum(root, 22) print(res, '\n', res2)
class Solution: def majorityElement(self, nums: List[int]) -> List[int]: nums_dict = {} for num in nums: if num in nums_dict: nums_dict[num] += 1 else: nums_dict[num] = 1 return [key for key, value in nums_dict.items() if value > len(nums) / 3]
class Solution: def majority_element(self, nums: List[int]) -> List[int]: nums_dict = {} for num in nums: if num in nums_dict: nums_dict[num] += 1 else: nums_dict[num] = 1 return [key for (key, value) in nums_dict.items() if value > len(nums) / 3]
# -*- python -*- load("@drake//tools/workspace:github.bzl", "github_archive") def scs_repository( name, mirrors = None): github_archive( name = name, repository = "cvxgrp/scs", # When updating this commit, see drake/tools/workspace/qdldl/README.md. commit = "v2.1.3", sha256 = "cb139aa8a53b8f6a7f2bacec4315b449ce366ec80b328e823efbaab56c847d20", # noqa build_file = "@drake//tools/workspace/scs:package.BUILD.bazel", patches = [ # Fix some include paths for our build of QDLDL. # TODO(jwnimmer-tri) We should upstream these options under a # config switch. "@drake//tools/workspace/scs:private.h.diff", # Fix sizeof(bool) for our build of QDLDL. # TODO(jwnimmer-tri) We should upstream this fix. "@drake//tools/workspace/scs:private.c.diff", ], mirrors = mirrors, )
load('@drake//tools/workspace:github.bzl', 'github_archive') def scs_repository(name, mirrors=None): github_archive(name=name, repository='cvxgrp/scs', commit='v2.1.3', sha256='cb139aa8a53b8f6a7f2bacec4315b449ce366ec80b328e823efbaab56c847d20', build_file='@drake//tools/workspace/scs:package.BUILD.bazel', patches=['@drake//tools/workspace/scs:private.h.diff', '@drake//tools/workspace/scs:private.c.diff'], mirrors=mirrors)
while True: ans = sorted([int(n) for n in input().split()]) if sum(ans) == 0: break print(*ans)
while True: ans = sorted([int(n) for n in input().split()]) if sum(ans) == 0: break print(*ans)
{ "object_templates": [ { "name": "fridge", "description": ["Fridge desc."], "container": [10] }, { "type_name": "barrel", "description": ["Barrel desc."], "interest": [5], "sound": { "OPEN": 2 }, "container": [5], }, { "type_name": "stove", "description": ["device desc."], "device": [] } ] }
{'object_templates': [{'name': 'fridge', 'description': ['Fridge desc.'], 'container': [10]}, {'type_name': 'barrel', 'description': ['Barrel desc.'], 'interest': [5], 'sound': {'OPEN': 2}, 'container': [5]}, {'type_name': 'stove', 'description': ['device desc.'], 'device': []}]}
# card_hold_href is the stored href for the CardHold card_hold = balanced.CardHold.fetch(card_hold_href) debit = card_hold.capture( appears_on_statement_as='ShowsUpOnStmt', description='Some descriptive text for the debit in the dashboard' )
card_hold = balanced.CardHold.fetch(card_hold_href) debit = card_hold.capture(appears_on_statement_as='ShowsUpOnStmt', description='Some descriptive text for the debit in the dashboard')
''' Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? ''' class Solution: def singleNumber(self, nums: List[int]) -> int: d = dict() for i in range(len(nums)): if nums[i] not in d: d[nums[i]] = 1 else: d[nums[i]]+=1 for k in d.keys(): if d[k] == 1: return k
""" Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? """ class Solution: def single_number(self, nums: List[int]) -> int: d = dict() for i in range(len(nums)): if nums[i] not in d: d[nums[i]] = 1 else: d[nums[i]] += 1 for k in d.keys(): if d[k] == 1: return k
class Android: # adb keyevent KEYCODE_ENTER = "KEYCODE_DPAD_CENTER" KEYCODE_RIGHT = "KEYCODE_DPAD_RIGHT" KEYCODE_LEFT = "KEYCODE_DPAD_LEFT" KEYCODE_DOWN = "KEYCODE_DPAD_DOWN" KEYCODE_UP = "KEYCODE_DPAD_UP" KEYCODE_SPACE = "KEYCODE_SPACE" # adb get property PROP_LANGUAGE = "persist.sys.language" PROP_COUNTRY = "persist.sys.country" PROP_BOOT_COMPLETED = "sys.boot_completed" PROP_SIM_STATE = "gsm.sim.state" # adb shell dumpsys category CATEGORY_MEDIA_AUDIO_FLINGER = "media.audio_flinger" CATEGORY_POWER = "power" CATEGORY_INPUT = "input" CATEGORY_WIFI = "wifi" CATEGORY_AUDIO = "audio" CATEGORY_STATUSBAR = "statusbar" CATEGORY_ACTIVITY = "activity activities" VAL_BATTERY = "mBatteryLevel" # UiAutomator Jar : Default LASCALL JAR_AUBS = "aubs.jar" # AUBS Method AUBS = "jp.setsulla.aubs.Aubs" AUBS_SYSTEM_ALLOWAPP = "jp.setsulla.aubs.system.AndroidTest#testAllowSettingsApp" # AURA Service AURA_PACKAGE = "jp.setsulla.aura" AURA_DEBUGON = "jp.setsulla.aura.DEBUG_ON"
class Android: keycode_enter = 'KEYCODE_DPAD_CENTER' keycode_right = 'KEYCODE_DPAD_RIGHT' keycode_left = 'KEYCODE_DPAD_LEFT' keycode_down = 'KEYCODE_DPAD_DOWN' keycode_up = 'KEYCODE_DPAD_UP' keycode_space = 'KEYCODE_SPACE' prop_language = 'persist.sys.language' prop_country = 'persist.sys.country' prop_boot_completed = 'sys.boot_completed' prop_sim_state = 'gsm.sim.state' category_media_audio_flinger = 'media.audio_flinger' category_power = 'power' category_input = 'input' category_wifi = 'wifi' category_audio = 'audio' category_statusbar = 'statusbar' category_activity = 'activity activities' val_battery = 'mBatteryLevel' jar_aubs = 'aubs.jar' aubs = 'jp.setsulla.aubs.Aubs' aubs_system_allowapp = 'jp.setsulla.aubs.system.AndroidTest#testAllowSettingsApp' aura_package = 'jp.setsulla.aura' aura_debugon = 'jp.setsulla.aura.DEBUG_ON'
gainGyroAngle = 1156*1.4 gainGyroRate = 146*0.85 gainMotorAngle = 7*1 gainMotorAngularSpeed = 9*0.95 gainMotorAngleErrorAccumulated = 0.6
gain_gyro_angle = 1156 * 1.4 gain_gyro_rate = 146 * 0.85 gain_motor_angle = 7 * 1 gain_motor_angular_speed = 9 * 0.95 gain_motor_angle_error_accumulated = 0.6
# Upper makes a string completely capitalized. parrot = "norwegian blue" print ("parrot").upper()
parrot = 'norwegian blue' print('parrot').upper()
file = open('binaryBoarding_input.py', 'r') tickets = file.readlines() total_rows = 128 total_columns = 8 def find_row(boarding_pass): min_row = 0 max_row = total_rows - 1 for letter in boarding_pass[:7]: if letter == 'F': max_row = max_row - int((max_row - min_row) / 2) - 1 elif letter == 'B': min_row = min_row + int((max_row - min_row) / 2) + 1 return max_row def find_seat(boarding_pass): min_seat = 0 max_seat = total_columns - 1 for letter in boarding_pass[7:]: if letter == 'R': min_seat = min_seat + int((max_seat - min_seat) / 2) + 1 elif letter == 'L': max_seat = max_seat - int((max_seat - min_seat) / 2) - 1 return max_seat claimed_seats = [False] * total_columns * total_rows empty_seats = [] for i in range(total_rows): for j in range(total_columns): empty_seats.append((i, j)) for ticket in tickets: row = find_row(ticket) seat = find_seat(ticket) seat_id = row * 8 + seat claimed_seats[seat_id] = True for i in range(len(claimed_seats)): is_taken = claimed_seats[i] if is_taken: empty_seats[i] = False for i in range(1, len(empty_seats) - 1): seat_before = empty_seats[i - 1] seat = empty_seats[i] seat_after = empty_seats[i + 1] if seat and not seat_before and not seat_after: row = seat[0] column = seat[1] print(row * 8 + column)
file = open('binaryBoarding_input.py', 'r') tickets = file.readlines() total_rows = 128 total_columns = 8 def find_row(boarding_pass): min_row = 0 max_row = total_rows - 1 for letter in boarding_pass[:7]: if letter == 'F': max_row = max_row - int((max_row - min_row) / 2) - 1 elif letter == 'B': min_row = min_row + int((max_row - min_row) / 2) + 1 return max_row def find_seat(boarding_pass): min_seat = 0 max_seat = total_columns - 1 for letter in boarding_pass[7:]: if letter == 'R': min_seat = min_seat + int((max_seat - min_seat) / 2) + 1 elif letter == 'L': max_seat = max_seat - int((max_seat - min_seat) / 2) - 1 return max_seat claimed_seats = [False] * total_columns * total_rows empty_seats = [] for i in range(total_rows): for j in range(total_columns): empty_seats.append((i, j)) for ticket in tickets: row = find_row(ticket) seat = find_seat(ticket) seat_id = row * 8 + seat claimed_seats[seat_id] = True for i in range(len(claimed_seats)): is_taken = claimed_seats[i] if is_taken: empty_seats[i] = False for i in range(1, len(empty_seats) - 1): seat_before = empty_seats[i - 1] seat = empty_seats[i] seat_after = empty_seats[i + 1] if seat and (not seat_before) and (not seat_after): row = seat[0] column = seat[1] print(row * 8 + column)
x = int(input()) y = int(input()) NotMult = 0 if x<y: for c in range(x, y+1): if (c%13)!=0: NotMult += c if x>y: for c in range(y, x+1): if (c%13)!=0: NotMult += c print(NotMult)
x = int(input()) y = int(input()) not_mult = 0 if x < y: for c in range(x, y + 1): if c % 13 != 0: not_mult += c if x > y: for c in range(y, x + 1): if c % 13 != 0: not_mult += c print(NotMult)
#!/usr/bin/env python # -*- coding: UTF-8 -*- def test1(): print('\ntest1') x = 10 y = 1 result = x if x > y else y print(result) def max2(x, y): return x if x > y else y def test2(): print('\ntest2') print(max2(10, 20)) print(max2(2, 1)) def main(): test1() test2() if __name__ == "__main__": main()
def test1(): print('\ntest1') x = 10 y = 1 result = x if x > y else y print(result) def max2(x, y): return x if x > y else y def test2(): print('\ntest2') print(max2(10, 20)) print(max2(2, 1)) def main(): test1() test2() if __name__ == '__main__': main()
name = input("What is your name?") quest = input("What is your quest?") color = input("What is your favorite color?") print(f"So your name is {name}.\nYou seek to {quest}.\nYour favorite color is {color}.\nYou may cross!")
name = input('What is your name?') quest = input('What is your quest?') color = input('What is your favorite color?') print(f'So your name is {name}.\nYou seek to {quest}.\nYour favorite color is {color}.\nYou may cross!')
a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(a[0]): if b[i] < a[1]: print(b[i],end='') print(" ",end='')
a = list(map(int, input().split())) b = list(map(int, input().split())) for i in range(a[0]): if b[i] < a[1]: print(b[i], end='') print(' ', end='')
def main(): n = int(input()) v = list(map(int, input().split())) m = dict() res = 0 for i in v: if i not in m: m[i] = 0 m[i] += 1 k = v.copy() for i in range(n - 1, 0, -1): k[i - 1] = k[i] + k[i - 1] for i in range(0, n - 1): res += -(n - i - 1) * v[i] + k[i + 1] m[v[i]] -= 1 if v[i] + 1 in m: res -= m[v[i] + 1] if v[i] - 1 in m: res += m[v[i] - 1] print(res) if __name__ == '__main__': main()
def main(): n = int(input()) v = list(map(int, input().split())) m = dict() res = 0 for i in v: if i not in m: m[i] = 0 m[i] += 1 k = v.copy() for i in range(n - 1, 0, -1): k[i - 1] = k[i] + k[i - 1] for i in range(0, n - 1): res += -(n - i - 1) * v[i] + k[i + 1] m[v[i]] -= 1 if v[i] + 1 in m: res -= m[v[i] + 1] if v[i] - 1 in m: res += m[v[i] - 1] print(res) if __name__ == '__main__': main()
expected_output = { "main": { "chassis": { "C9407R": { "name": "Chassis", "descr": "Cisco Catalyst 9400 Series 7 Slot Chassis", "pid": "C9407R", "vid": "V01", "sn": "******", } }, "TenGigabitEthernet3/0/1": { "SFP-10G-SR": { "name": "TenGigabitEthernet3/0/1", "descr": "SFP 10GBASE-SR", "pid": "SFP-10G-SR", "vid": "01", "sn": "******", } }, "TenGigabitEthernet3/0/2": { "SFP-10G-SR": { "name": "TenGigabitEthernet3/0/2", "descr": "SFP 10GBASE-SR", "pid": "SFP-10G-SR", "vid": "01", "sn": "******", } }, "TenGigabitEthernet3/0/3": { "SFP-10G-SR": { "name": "TenGigabitEthernet3/0/3", "descr": "SFP 10GBASE-SR", "pid": "SFP-10G-SR", "vid": "01", "sn": "******", } }, "TenGigabitEthernet3/0/4": { "SFP-10G-SR": { "name": "TenGigabitEthernet3/0/4", "descr": "SFP 10GBASE-SR", "pid": "SFP-10G-SR", "vid": "01", "sn": "******", } }, "TenGigabitEthernet3/0/8": { "QFBR-5798L": { "name": "TenGigabitEthernet3/0/8", "descr": "GE SX", "pid": "QFBR-5798L", "vid": "", "sn": "******", } }, }, "slot": { "Slot_1_Linecard": { "lc": { "C9400-LC-48P": { "name": "Slot 1 Linecard", "descr": "Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)", "pid": "C9400-LC-48P", "vid": "V01", "sn": "******", } } }, "Slot_2_Linecard": { "lc": { "C9400-LC-48P": { "name": "Slot 2 Linecard", "descr": "Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)", "pid": "C9400-LC-48P", "vid": "V01", "sn": "******", } } }, "Slot_5_Linecard": { "lc": { "C9400-LC-48P": { "name": "Slot 5 Linecard", "descr": "Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)", "pid": "C9400-LC-48P", "vid": "V01", "sn": "******", } } }, "Slot_6_Linecard": { "lc": { "C9400-LC-48P": { "name": "Slot 6 Linecard", "descr": "Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)", "pid": "C9400-LC-48P", "vid": "V01", "sn": "******", } } }, "Slot_3_Supervisor": { "other": { "C9400-SUP-1": { "name": "Slot 3 Supervisor", "descr": "Cisco Catalyst 9400 Series Supervisor 1 Module", "pid": "C9400-SUP-1", "vid": "V02", "sn": "******", } } }, "P1": { "other": { "C9400-PWR-3200AC": { "name": "Power Supply Module 1", "descr": "Cisco Catalyst 9400 Series 3200W AC Power Supply", "pid": "C9400-PWR-3200AC", "vid": "V01", "sn": "******", } } }, "P2": { "other": { "C9400-PWR-3200AC": { "name": "Power Supply Module 2", "descr": "Cisco Catalyst 9400 Series 3200W AC Power Supply", "pid": "C9400-PWR-3200AC", "vid": "V01", "sn": "DTM224703G0", } } }, "Fan_Tray": { "other": { "C9407-FAN": { "name": "Fan Tray", "descr": "Cisco Catalyst 9400 Series 7 Slot Chassis Fan Tray", "pid": "C9407-FAN", "vid": "V01", "sn": "******", } } }, }, }
expected_output = {'main': {'chassis': {'C9407R': {'name': 'Chassis', 'descr': 'Cisco Catalyst 9400 Series 7 Slot Chassis', 'pid': 'C9407R', 'vid': 'V01', 'sn': '******'}}, 'TenGigabitEthernet3/0/1': {'SFP-10G-SR': {'name': 'TenGigabitEthernet3/0/1', 'descr': 'SFP 10GBASE-SR', 'pid': 'SFP-10G-SR', 'vid': '01', 'sn': '******'}}, 'TenGigabitEthernet3/0/2': {'SFP-10G-SR': {'name': 'TenGigabitEthernet3/0/2', 'descr': 'SFP 10GBASE-SR', 'pid': 'SFP-10G-SR', 'vid': '01', 'sn': '******'}}, 'TenGigabitEthernet3/0/3': {'SFP-10G-SR': {'name': 'TenGigabitEthernet3/0/3', 'descr': 'SFP 10GBASE-SR', 'pid': 'SFP-10G-SR', 'vid': '01', 'sn': '******'}}, 'TenGigabitEthernet3/0/4': {'SFP-10G-SR': {'name': 'TenGigabitEthernet3/0/4', 'descr': 'SFP 10GBASE-SR', 'pid': 'SFP-10G-SR', 'vid': '01', 'sn': '******'}}, 'TenGigabitEthernet3/0/8': {'QFBR-5798L': {'name': 'TenGigabitEthernet3/0/8', 'descr': 'GE SX', 'pid': 'QFBR-5798L', 'vid': '', 'sn': '******'}}}, 'slot': {'Slot_1_Linecard': {'lc': {'C9400-LC-48P': {'name': 'Slot 1 Linecard', 'descr': 'Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)', 'pid': 'C9400-LC-48P', 'vid': 'V01', 'sn': '******'}}}, 'Slot_2_Linecard': {'lc': {'C9400-LC-48P': {'name': 'Slot 2 Linecard', 'descr': 'Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)', 'pid': 'C9400-LC-48P', 'vid': 'V01', 'sn': '******'}}}, 'Slot_5_Linecard': {'lc': {'C9400-LC-48P': {'name': 'Slot 5 Linecard', 'descr': 'Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)', 'pid': 'C9400-LC-48P', 'vid': 'V01', 'sn': '******'}}}, 'Slot_6_Linecard': {'lc': {'C9400-LC-48P': {'name': 'Slot 6 Linecard', 'descr': 'Cisco Catalyst 9400 Series 48-Port POE 10/100/1000 (RJ-45)', 'pid': 'C9400-LC-48P', 'vid': 'V01', 'sn': '******'}}}, 'Slot_3_Supervisor': {'other': {'C9400-SUP-1': {'name': 'Slot 3 Supervisor', 'descr': 'Cisco Catalyst 9400 Series Supervisor 1 Module', 'pid': 'C9400-SUP-1', 'vid': 'V02', 'sn': '******'}}}, 'P1': {'other': {'C9400-PWR-3200AC': {'name': 'Power Supply Module 1', 'descr': 'Cisco Catalyst 9400 Series 3200W AC Power Supply', 'pid': 'C9400-PWR-3200AC', 'vid': 'V01', 'sn': '******'}}}, 'P2': {'other': {'C9400-PWR-3200AC': {'name': 'Power Supply Module 2', 'descr': 'Cisco Catalyst 9400 Series 3200W AC Power Supply', 'pid': 'C9400-PWR-3200AC', 'vid': 'V01', 'sn': 'DTM224703G0'}}}, 'Fan_Tray': {'other': {'C9407-FAN': {'name': 'Fan Tray', 'descr': 'Cisco Catalyst 9400 Series 7 Slot Chassis Fan Tray', 'pid': 'C9407-FAN', 'vid': 'V01', 'sn': '******'}}}}}
a = int(input()) s = list(range(1, a+1)) k = len(s) while k > 1: if k & 1: s = s[::2] del s[0] else: s = s[::2] k = len(s) print(s[0])
a = int(input()) s = list(range(1, a + 1)) k = len(s) while k > 1: if k & 1: s = s[::2] del s[0] else: s = s[::2] k = len(s) print(s[0])
ANONYMOUS = 'Anonymous User' PUBLIC_NON_REQUESTER = 'Public User - Non-Requester' PUBLIC_REQUESTER = 'Public User - Requester' AGENCY_HELPER = 'Agency Helper' AGENCY_OFFICER = 'Agency FOIL Officer' AGENCY_ADMIN = 'Agency Administrator' POINT_OF_CONTACT = 'point_of_contact'
anonymous = 'Anonymous User' public_non_requester = 'Public User - Non-Requester' public_requester = 'Public User - Requester' agency_helper = 'Agency Helper' agency_officer = 'Agency FOIL Officer' agency_admin = 'Agency Administrator' point_of_contact = 'point_of_contact'
class Solution: def partition(self, head, x): h1 = l1 = ListNode(0) h2 = l2 = ListNode(0) while head: if head.val < x: l1.next = head l1 = l1.next else: l2.next = head l2 = l2.next head = head.next l2.next = None l1.next = h2.next return h1.next
class Solution: def partition(self, head, x): h1 = l1 = list_node(0) h2 = l2 = list_node(0) while head: if head.val < x: l1.next = head l1 = l1.next else: l2.next = head l2 = l2.next head = head.next l2.next = None l1.next = h2.next return h1.next
# Python 2.7 Coordinate Generation MYARRAY = [] INCREMENTER = 0 while INCREMENTER < 501: MYARRAY.append([INCREMENTER, INCREMENTER*2]) INCREMENTER += 1
myarray = [] incrementer = 0 while INCREMENTER < 501: MYARRAY.append([INCREMENTER, INCREMENTER * 2]) incrementer += 1
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../build/common.gypi', ], 'target_defaults': { 'variables': { 'chromium_code': 1, 'version_py_path': '../../chrome/tools/build/version.py', 'version_path': 'VERSION', }, 'include_dirs': [ '../..', ], 'libraries': [ 'userenv.lib', ], 'sources': [ 'win/port_monitor/port_monitor.cc', 'win/port_monitor/port_monitor.h', 'win/port_monitor/port_monitor.def', ], }, 'conditions': [ ['OS=="win"', { 'targets' : [ { 'target_name': 'gcp_portmon', 'type': 'loadable_module', 'dependencies': [ '../../base/base.gyp:base', ], 'msvs_guid': 'ED3D7186-C94E-4D8B-A8E7-B7260F638F46', }, { 'target_name': 'gcp_portmon64', 'type': 'loadable_module', 'defines': [ '<@(nacl_win64_defines)', ], 'dependencies': [ '../../base/base.gyp:base_nacl_win64', ], 'msvs_guid': '9BB292F4-6104-495A-B415-C3E314F46D6F', 'configurations': { 'Common_Base': { 'msvs_target_platform': 'x64', }, }, }, { 'target_name': 'virtual_driver_unittests', 'type': 'executable', 'msvs_guid': '97F82D29-58D8-4909-86C8-F2BBBCC4FEBF', 'dependencies': [ '../../base/base.gyp:base', '../../base/base.gyp:test_support_base', '../../testing/gmock.gyp:gmock', '../../testing/gtest.gyp:gtest', ], 'sources': [ # Infrastructure files. '../../base/test/run_all_unittests.cc', 'win/port_monitor/port_monitor_unittest.cc' ], }, ], }, ], ] } # Local Variables: # tab-width:2 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=2 shiftwidth=2:
{'includes': ['../../build/common.gypi'], 'target_defaults': {'variables': {'chromium_code': 1, 'version_py_path': '../../chrome/tools/build/version.py', 'version_path': 'VERSION'}, 'include_dirs': ['../..'], 'libraries': ['userenv.lib'], 'sources': ['win/port_monitor/port_monitor.cc', 'win/port_monitor/port_monitor.h', 'win/port_monitor/port_monitor.def']}, 'conditions': [['OS=="win"', {'targets': [{'target_name': 'gcp_portmon', 'type': 'loadable_module', 'dependencies': ['../../base/base.gyp:base'], 'msvs_guid': 'ED3D7186-C94E-4D8B-A8E7-B7260F638F46'}, {'target_name': 'gcp_portmon64', 'type': 'loadable_module', 'defines': ['<@(nacl_win64_defines)'], 'dependencies': ['../../base/base.gyp:base_nacl_win64'], 'msvs_guid': '9BB292F4-6104-495A-B415-C3E314F46D6F', 'configurations': {'Common_Base': {'msvs_target_platform': 'x64'}}}, {'target_name': 'virtual_driver_unittests', 'type': 'executable', 'msvs_guid': '97F82D29-58D8-4909-86C8-F2BBBCC4FEBF', 'dependencies': ['../../base/base.gyp:base', '../../base/base.gyp:test_support_base', '../../testing/gmock.gyp:gmock', '../../testing/gtest.gyp:gtest'], 'sources': ['../../base/test/run_all_unittests.cc', 'win/port_monitor/port_monitor_unittest.cc']}]}]]}
# -*- coding: utf-8 -*- '''Snippets for string. Available functions: - to_titlecase: Convert the character string to titlecase. ''' def to_titlecase(s: str) -> str: '''For example: >>> 'Hello world'.title() 'Hello World' Args: str: String excluding apostrophes in contractions and possessives form word boundaries. Returns: A titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase. See: https://docs.python.org/3.6/library/stdtypes.html#str.title ''' return s.title()
"""Snippets for string. Available functions: - to_titlecase: Convert the character string to titlecase. """ def to_titlecase(s: str) -> str: """For example: >>> 'Hello world'.title() 'Hello World' Args: str: String excluding apostrophes in contractions and possessives form word boundaries. Returns: A titlecased version of the string where words start with an uppercase character and the remaining characters are lowercase. See: https://docs.python.org/3.6/library/stdtypes.html#str.title """ return s.title()
t = int(input()) for t_itr in range(t): n = int(input()) count = 0 for i in range(n+1): if i%2 == 0: count+=1 else: count*=2 print(count)
t = int(input()) for t_itr in range(t): n = int(input()) count = 0 for i in range(n + 1): if i % 2 == 0: count += 1 else: count *= 2 print(count)
class DaemonEvent(object): def __init__(self, name, params) -> None: super().__init__() self.name = name self.params = params @classmethod def from_json(cls, json): return DaemonEvent(json["event"], json["params"])
class Daemonevent(object): def __init__(self, name, params) -> None: super().__init__() self.name = name self.params = params @classmethod def from_json(cls, json): return daemon_event(json['event'], json['params'])
#func-with-var-args.py def addall(*nums): ttl=0 for num in nums: ttl=ttl+num return ttl total=addall(10,20,50,70) print ('Total of 4 numbers:',total) total=addall(11,34,43) print ('Total of 3 numbers:',total)
def addall(*nums): ttl = 0 for num in nums: ttl = ttl + num return ttl total = addall(10, 20, 50, 70) print('Total of 4 numbers:', total) total = addall(11, 34, 43) print('Total of 3 numbers:', total)
#!/usr/bin/env python __all__ = ["test_bedgraph", "test_clustal", "test_fasta"] __author__ = "" __copyright__ = "Copyright 2007-2020, The Cogent Project" __credits__ = [ "Rob Knight", "Gavin Huttley", "Sandra Smit", "Marcin Cieslik", "Jeremy Widmann", ] __license__ = "BSD-3" __version__ = "2020.2.7a" __maintainer__ = "Gavin Huttley" __email__ = "gavin.huttley@anu.edu.au" __status__ = "Production"
__all__ = ['test_bedgraph', 'test_clustal', 'test_fasta'] __author__ = '' __copyright__ = 'Copyright 2007-2020, The Cogent Project' __credits__ = ['Rob Knight', 'Gavin Huttley', 'Sandra Smit', 'Marcin Cieslik', 'Jeremy Widmann'] __license__ = 'BSD-3' __version__ = '2020.2.7a' __maintainer__ = 'Gavin Huttley' __email__ = 'gavin.huttley@anu.edu.au' __status__ = 'Production'
BOT_NAME = 'tabcrawler' SPIDER_MODULES = ['tabcrawler.spiders'] NEWSPIDER_MODULE = 'tabcrawler.spiders' DOWNLOAD_DELAY = 3 ITEM_PIPELINES = ['scrapy.contrib.pipeline.images.ImagesPipeline'] IMAGES_STORE = '/Users/jinzemin/Desktop/GuitarFan/tabcrawler/tabs' # ITEM_PIPELINES = [ # 'tabcrawler.pipelines.ArtistPipeline', # ] # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'tabcrawler (+http://www.yourdomain.com)'
bot_name = 'tabcrawler' spider_modules = ['tabcrawler.spiders'] newspider_module = 'tabcrawler.spiders' download_delay = 3 item_pipelines = ['scrapy.contrib.pipeline.images.ImagesPipeline'] images_store = '/Users/jinzemin/Desktop/GuitarFan/tabcrawler/tabs'
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] counter = 0 for number in my_list: counter = counter + number print(counter)
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] counter = 0 for number in my_list: counter = counter + number print(counter)
''' It's Christmas time! To share his Christmas spirit with all his friends, the young Christmas Elf decided to send each of them a Christmas e-mail with a nice Christmas tree. Unfortunately, Internet traffic is very expensive in the North Pole, so instead of sending an actual image he got creative and drew the tree using nothing but asterisks ('*' symbols). He has given you the specs (see below) and your task is to write a program that will generate trees following the spec and some initial parameters. Here is a formal definition of how the tree should be built, but before you read it the Elf HIGHLY recommends first looking at the examples that follow: Each tree has a crown as follows: * * *** Define a line as a horizontal group of asterisks and a level as a collection of levelHeight lines stacked one on top of the other. Below the crown there are levelNum levels. The tree is perfectly symmetrical so all the middle asterisks of the lines lie on the center of the tree. Each line of the same level (excluding the first one) has two more asterisks than the previous one (one added to each end); The number of asterisks in the first line of each level is chosen as follows: the first line of the first level has 5 asterisks; the first line of each consecutive level contains two more asterisks than the first line of the previous level. And finally there is the tree foot which has a height of levelNum and a width of: levelHeight asterisks if levelHeight is odd; levelHeight + 1 asterisks if levelHeight is even. Given levelNum and levelHeight, return the Christmas tree of the young elf. Example For levelNum = 1 and levelHeight = 3, the output should be christmasTree(levelNum, levelHeight) = [" *", " *", " ***", " *****", " *******", "*********", " ***"] , which represents the following tree: ___ * | * |-- the crown *** ___| ***** | ******* |-- level 1 ********* ___| *** ___|-- the foot For levelNum = 2 and levelHeight = 4, the output should be christmasTree(levelNum, levelHeight) = [" *", " *", " ***", " *****", " *******", " *********", " ***********", " *******", " *********", " ***********", "*************", " *****", " *****"] , which represents the following tree: ___ * | * | -- the crown *** ___| ***** | ******* | -- level 1 ********* | *********** ___| ******* | ********* | -- level 2 *********** | ************* ___| ***** | -- the foot ***** ___| ''' def christmasTree(levelNum, levelHeight): maxWidth = 5 + (levelNum-1)*2 + (levelHeight-1)*2 center = (maxWidth//2)+1 tree = [] # Crown appendToTree(tree, center, 1) appendToTree(tree, center, 1) appendToTree(tree, center, 3) # Levels for i in range(levelNum): appendToTree(tree, center, 5+(2*i)) for j in range(1, levelHeight): appendToTree(tree, center, 5+(2*i)+(2*j)) # Base baseWidth = levelHeight if levelHeight % 2 == 0: baseWidth = levelHeight + 1 for i in range(levelNum): appendToTree(tree, center, baseWidth) return tree def appendToTree(tree, center, numOfAsterisks): middle = (numOfAsterisks // 2) + 1 tree.append(" " * (center - middle) + "*" * numOfAsterisks)
""" It's Christmas time! To share his Christmas spirit with all his friends, the young Christmas Elf decided to send each of them a Christmas e-mail with a nice Christmas tree. Unfortunately, Internet traffic is very expensive in the North Pole, so instead of sending an actual image he got creative and drew the tree using nothing but asterisks ('*' symbols). He has given you the specs (see below) and your task is to write a program that will generate trees following the spec and some initial parameters. Here is a formal definition of how the tree should be built, but before you read it the Elf HIGHLY recommends first looking at the examples that follow: Each tree has a crown as follows: * * *** Define a line as a horizontal group of asterisks and a level as a collection of levelHeight lines stacked one on top of the other. Below the crown there are levelNum levels. The tree is perfectly symmetrical so all the middle asterisks of the lines lie on the center of the tree. Each line of the same level (excluding the first one) has two more asterisks than the previous one (one added to each end); The number of asterisks in the first line of each level is chosen as follows: the first line of the first level has 5 asterisks; the first line of each consecutive level contains two more asterisks than the first line of the previous level. And finally there is the tree foot which has a height of levelNum and a width of: levelHeight asterisks if levelHeight is odd; levelHeight + 1 asterisks if levelHeight is even. Given levelNum and levelHeight, return the Christmas tree of the young elf. Example For levelNum = 1 and levelHeight = 3, the output should be christmasTree(levelNum, levelHeight) = [" *", " *", " ***", " *****", " *******", "*********", " ***"] , which represents the following tree: ___ * | * |-- the crown *** ___| ***** | ******* |-- level 1 ********* ___| *** ___|-- the foot For levelNum = 2 and levelHeight = 4, the output should be christmasTree(levelNum, levelHeight) = [" *", " *", " ***", " *****", " *******", " *********", " ***********", " *******", " *********", " ***********", "*************", " *****", " *****"] , which represents the following tree: ___ * | * | -- the crown *** ___| ***** | ******* | -- level 1 ********* | *********** ___| ******* | ********* | -- level 2 *********** | ************* ___| ***** | -- the foot ***** ___| """ def christmas_tree(levelNum, levelHeight): max_width = 5 + (levelNum - 1) * 2 + (levelHeight - 1) * 2 center = maxWidth // 2 + 1 tree = [] append_to_tree(tree, center, 1) append_to_tree(tree, center, 1) append_to_tree(tree, center, 3) for i in range(levelNum): append_to_tree(tree, center, 5 + 2 * i) for j in range(1, levelHeight): append_to_tree(tree, center, 5 + 2 * i + 2 * j) base_width = levelHeight if levelHeight % 2 == 0: base_width = levelHeight + 1 for i in range(levelNum): append_to_tree(tree, center, baseWidth) return tree def append_to_tree(tree, center, numOfAsterisks): middle = numOfAsterisks // 2 + 1 tree.append(' ' * (center - middle) + '*' * numOfAsterisks)
cpicker = lv.cpicker(lv.scr_act(),None) cpicker.set_size(200, 200) cpicker.align(None, lv.ALIGN.CENTER, 0, 0)
cpicker = lv.cpicker(lv.scr_act(), None) cpicker.set_size(200, 200) cpicker.align(None, lv.ALIGN.CENTER, 0, 0)
class Solution: def partitionLabels(self, s: str) -> List[int]: # base case if we only have 1 letter if len(s)<2: return [1] #change to [len(s)] response = [] # final response memory = [] #track memory.append(s[0])# we already known that we have at least 2 letters count = 1 # counter i = 1 while i<len(s): if s[i] in memory: count+=1 #if the current value char is in our memory add the count else: # is a new character bl = False # boolean flag, true to add the new character into the current count or in a new for each in memory: #we want to keep track of each letter into the remaining string if each in s[i+1:]: #if at least one of the letters in our memory appers later, we can change the flag and stop the for bl = True break if bl: # add the new letter into the memory memory.append(s[i]) count+=1 else: memory = [] # empty the memory memory.append(s[i]) # add the current new character response.append(count) # add the current count into the response count = 1 #counter i+=1 response.append(count) #add the remaining letters return response
class Solution: def partition_labels(self, s: str) -> List[int]: if len(s) < 2: return [1] response = [] memory = [] memory.append(s[0]) count = 1 i = 1 while i < len(s): if s[i] in memory: count += 1 else: bl = False for each in memory: if each in s[i + 1:]: bl = True break if bl: memory.append(s[i]) count += 1 else: memory = [] memory.append(s[i]) response.append(count) count = 1 i += 1 response.append(count) return response
class Solution: def isPowerOfTwo(self, n: int) -> bool: b = bin(n) if b[2] != '1': return False for bit in b[3:]: if bit != '0': return False return True print(Solution().isPowerOfTwo(1)) print(Solution().isPowerOfTwo(16)) print(Solution().isPowerOfTwo(3)) print(Solution().isPowerOfTwo(4)) print(Solution().isPowerOfTwo(5)) print(Solution().isPowerOfTwo(-5)) print(Solution().isPowerOfTwo(0))
class Solution: def is_power_of_two(self, n: int) -> bool: b = bin(n) if b[2] != '1': return False for bit in b[3:]: if bit != '0': return False return True print(solution().isPowerOfTwo(1)) print(solution().isPowerOfTwo(16)) print(solution().isPowerOfTwo(3)) print(solution().isPowerOfTwo(4)) print(solution().isPowerOfTwo(5)) print(solution().isPowerOfTwo(-5)) print(solution().isPowerOfTwo(0))
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBox.msg;/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBoxes.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsAction.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsActionGoal.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsActionResult.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsActionFeedback.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsGoal.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsResult.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsFeedback.msg" services_str = "" pkg_name = "darknet_ros_msgs" dependencies_str = "actionlib_msgs;geometry_msgs;sensor_msgs;std_msgs" langs = "gencpp;geneus;genlisp;gennodejs;genpy" dep_include_paths_str = "darknet_ros_msgs;/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg;darknet_ros_msgs;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg;actionlib_msgs;/opt/ros/kinetic/share/actionlib_msgs/cmake/../msg;geometry_msgs;/opt/ros/kinetic/share/geometry_msgs/cmake/../msg;sensor_msgs;/opt/ros/kinetic/share/sensor_msgs/cmake/../msg;std_msgs;/home/kalyco/mfp_workspace/src/std_msgs/msg" PYTHON_EXECUTABLE = "/usr/bin/python" package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = "/opt/ros/kinetic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
messages_str = '/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBox.msg;/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg/BoundingBoxes.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsAction.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsActionGoal.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsActionResult.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsActionFeedback.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsGoal.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsResult.msg;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg/CheckForObjectsFeedback.msg' services_str = '' pkg_name = 'darknet_ros_msgs' dependencies_str = 'actionlib_msgs;geometry_msgs;sensor_msgs;std_msgs' langs = 'gencpp;geneus;genlisp;gennodejs;genpy' dep_include_paths_str = 'darknet_ros_msgs;/home/kalyco/mfp_workspace/src/darknet_ros/darknet_ros_msgs/msg;darknet_ros_msgs;/home/kalyco/mfp_workspace/devel/.private/darknet_ros_msgs/share/darknet_ros_msgs/msg;actionlib_msgs;/opt/ros/kinetic/share/actionlib_msgs/cmake/../msg;geometry_msgs;/opt/ros/kinetic/share/geometry_msgs/cmake/../msg;sensor_msgs;/opt/ros/kinetic/share/sensor_msgs/cmake/../msg;std_msgs;/home/kalyco/mfp_workspace/src/std_msgs/msg' python_executable = '/usr/bin/python' package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = '/opt/ros/kinetic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py'
# exit from infinite loop v.2 # using flag prompt = ("\nType 'x' to exit.\nEnter: ") flag = True while flag: msg = input(prompt) if msg == 'x': flag = False else: print(msg)
prompt = "\nType 'x' to exit.\nEnter: " flag = True while flag: msg = input(prompt) if msg == 'x': flag = False else: print(msg)
text = "".join(input().split()) for index,emoticon in enumerate(text): if emoticon == ":": print(f"{emoticon+text[index+1]}")
text = ''.join(input().split()) for (index, emoticon) in enumerate(text): if emoticon == ':': print(f'{emoticon + text[index + 1]}')
word_size = 4 num_words = 16 words_per_row = 1 local_array_size = 4 output_extended_config = True output_datasheet_info = True netlist_only = True nominal_corner_only = True
word_size = 4 num_words = 16 words_per_row = 1 local_array_size = 4 output_extended_config = True output_datasheet_info = True netlist_only = True nominal_corner_only = True
# Intersection Of Sorted Arrays # https://www.interviewbit.com/problems/intersection-of-sorted-arrays/ # # Find the intersection of two sorted arrays. # OR in other words, # Given 2 sorted arrays, find all the elements which occur in both the arrays. # # Example : # # Input : # A : [1 2 3 3 4 5 6] # B : [3 3 5] # # Output : [3 3 5] # # Input : # A : [1 2 3 3 4 5 6] # B : [3 5] # # Output : [3 5] # # NOTE : For the purpose of this problem ( as also conveyed by the sample case ), assume that elements that # appear more than once in both arrays should be included multiple times in the final output. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class Solution: # @param A : tuple of integers # @param B : tuple of integers # @return a list of integers def intersect(self, A, B): i = j = 0 res = [] while i < len(A) and j < len(B): if A[i] == B[j]: res.append(A[i]) i += 1 j += 1 elif A[i] < B[j]: i += 1 else: j += 1 return res # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if __name__ == "__main__": A = [1, 2, 3, 3, 4, 5, 6] B = [3, 5] s = Solution() print(s.intersect(A, B))
class Solution: def intersect(self, A, B): i = j = 0 res = [] while i < len(A) and j < len(B): if A[i] == B[j]: res.append(A[i]) i += 1 j += 1 elif A[i] < B[j]: i += 1 else: j += 1 return res if __name__ == '__main__': a = [1, 2, 3, 3, 4, 5, 6] b = [3, 5] s = solution() print(s.intersect(A, B))
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # SNMP Error Codes # ---------------------------------------------------------------------- # Copyright (C) 2007-2017 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # No error occurred. This code is also used in all request PDUs, # since they have no error status to report. NO_ERROR = 0 # The size of the Response-PDU would be too large to transport. TOO_BIG = 1 # The name of a requested object was not found. NO_SUCH_NAME = 2 # A value in the request didn't match the structure that # the recipient of the request had for the object. # For example, an object in the request was specified # with an incorrect length or type. BAD_VALUE = 3 # An attempt was made to set a variable that has an # Access value indicating that it is read-only. READ_ONLY = 4 # An error occurred other than one indicated by # a more specific error code in this table. GEN_ERR = 5 # Access was denied to the object for security reasons. NO_ACCESS = 6 # The object type in a variable binding is incorrect for the object. WRONG_TYPE = 7 # A variable binding specifies a length incorrect for the object. WRONG_LENGTH = 8 # A variable binding specifies an encoding incorrect for the object. WRONG_ENCODING = 9 # The value given in a variable binding is not possible for the object. WRONG_VALUE = 10 # A specified variable does not exist and cannot be created. NO_CREATION = 11 # A variable binding specifies a value that could be held # by the variable but cannot be assigned to it at this time. INCONSISTENT_VALUE = 12 # An attempt to set a variable required # a resource that is not available. RESOURCE_UNAVAILABLE = 13 # An attempt to set a particular variable failed. COMMIT_FAILED = 14 # An attempt to set a particular variable as part of # a group of variables failed, and the attempt to then # undo the setting of other variables was not successful. UNDO_FAILED = 15 # A problem occurred in authorization. AUTHORIZATION_ERROR = 16 # The variable cannot be written or created. NOT_WRITABLE = 17 # The name in a variable binding specifies # a variable that does not exist. INCONSISTENT_NAME = 18 # Virtual code TIMED_OUT = -1 UNREACHABLE = -2 BER_ERROR = -3 class SNMPError(Exception): def __init__(self, code, oid=None): super(SNMPError, self).__init__() self.code = code self.oid = oid def __repr__(self): return "<SNMPError code=%s oid=%s>" % (self.code, self.oid)
no_error = 0 too_big = 1 no_such_name = 2 bad_value = 3 read_only = 4 gen_err = 5 no_access = 6 wrong_type = 7 wrong_length = 8 wrong_encoding = 9 wrong_value = 10 no_creation = 11 inconsistent_value = 12 resource_unavailable = 13 commit_failed = 14 undo_failed = 15 authorization_error = 16 not_writable = 17 inconsistent_name = 18 timed_out = -1 unreachable = -2 ber_error = -3 class Snmperror(Exception): def __init__(self, code, oid=None): super(SNMPError, self).__init__() self.code = code self.oid = oid def __repr__(self): return '<SNMPError code=%s oid=%s>' % (self.code, self.oid)
ACTORS = [ {"id":26073614,"name":"Al Pacino","photo":"https://placebear.com/342/479"}, {"id":77394988,"name":"Anthony Hopkins","photo":"https://placebear.com/305/469"}, {"id":44646271,"name":"Audrey Hepburn","photo":"https://placebear.com/390/442"}, {"id":85626345,"name":"Barbara Stanwyck","photo":"https://placebear.com/399/411"}, {"id":57946467,"name":"Barbra Streisand","photo":"https://placebear.com/328/490"}, {"id":44333164,"name":"Ben Kingsley","photo":"https://placebear.com/399/442"}, {"id":91171557,"name":"Bette Davis","photo":"https://placebear.com/318/496"}, {"id":25163439,"name":"Brad Pitt","photo":"https://placebear.com/359/430"}, {"id":59236719,"name":"Cate Blanchett","photo":"https://placebear.com/346/407"}, {"id":35491900,"name":"Christian Bale","photo":"https://placebear.com/363/440"}, {"id":48725048,"name":"Christoph Waltz","photo":"https://placebear.com/356/445"}, {"id":36858988,"name":"Christopher Walken","photo":"https://placebear.com/328/448"}, {"id":77052052,"name":"Clint Eastwood","photo":"https://placebear.com/311/428"}, {"id":74729990,"name":"Daniel Day-Lewis","photo":"https://placebear.com/393/480"}, {"id":75495971,"name":"Denzel Washington","photo":"https://placebear.com/392/471"}, {"id":49842505,"name":"Diane Keaton","photo":"https://placebear.com/310/462"}, {"id":16533679,"name":"Dustin Hoffman","photo":"https://placebear.com/306/425"}, {"id":77778079,"name":"Ed Harris","photo":"https://placebear.com/365/430"}, {"id":62340777,"name":"Edward Norton","photo":"https://placebear.com/356/486"}, {"id":45282572,"name":"Elizabeth Taylor","photo":"https://placebear.com/338/440"}, {"id":98253023,"name":"Ellen Burstyn","photo":"https://placebear.com/313/452"}, {"id":14389118,"name":"Emma Thompson","photo":"https://placebear.com/314/445"}, {"id":85245270,"name":"Faye Dunaway","photo":"https://placebear.com/352/495"}, {"id":77497258,"name":"Frances McDormand","photo":"https://placebear.com/368/404"}, {"id":69175505,"name":"Gary Oldman","photo":"https://placebear.com/380/468"}, {"id":52103198,"name":"Gene Hackman","photo":"https://placebear.com/326/464"}, {"id":53511355,"name":"George Clooney","photo":"https://placebear.com/350/405"}, {"id":46135141,"name":"Glenn Close","photo":"https://placebear.com/318/446"}, {"id":67466115,"name":"Grace Kelly","photo":"https://placebear.com/396/422"}, {"id":32111872,"name":"Greer Garson","photo":"https://placebear.com/331/464"}, {"id":38069638,"name":"Greta Garbo","photo":"https://placebear.com/344/467"}, {"id":30546602,"name":"Harrison Ford","photo":"https://placebear.com/324/471"}, {"id":78852790,"name":"Harvey Keitel","photo":"https://placebear.com/302/498"}, {"id":75916952,"name":"Heath Ledger","photo":"https://placebear.com/354/420"}, {"id":44647231,"name":"Helen Mirren","photo":"https://placebear.com/390/401"}, {"id":98319284,"name":"Hilary Swank","photo":"https://placebear.com/334/428"}, {"id":73307095,"name":"Holly Hunter","photo":"https://placebear.com/388/439"}, {"id":65927229,"name":"Ian McKellen","photo":"https://placebear.com/359/447"}, {"id":84415199,"name":"Ingrid Bergman","photo":"https://placebear.com/341/487"}, {"id":28676619,"name":"Jack Nicholson","photo":"https://placebear.com/335/461"}, {"id":66339602,"name":"Jane Fonda","photo":"https://placebear.com/323/471"}, {"id":22447589,"name":"Jane Wyman","photo":"https://placebear.com/373/469"}, {"id":52907687,"name":"Javier Bardem","photo":"https://placebear.com/366/421"}, {"id":35506267,"name":"Jeff Bridges","photo":"https://placebear.com/388/422"}, {"id":16807306,"name":"Jennifer Jones","photo":"https://placebear.com/333/498"}, {"id":63521043,"name":"Jessica Lange","photo":"https://placebear.com/309/413"}, {"id":91132400,"name":"Joan Crawford","photo":"https://placebear.com/322/437"}, {"id":74127064,"name":"Joan Fontaine","photo":"https://placebear.com/329/458"}, {"id":30283700,"name":"Joaquin Phoenix","photo":"https://placebear.com/316/452"}, {"id":40834926,"name":"Jodie Foster","photo":"https://placebear.com/307/439"}, {"id":59676726,"name":"Joe Pesci","photo":"https://placebear.com/388/434"}, {"id":18959030,"name":"Johnny Depp","photo":"https://placebear.com/337/422"}, {"id":19220801,"name":"Judi Dench","photo":"https://placebear.com/397/480"}, {"id":41880845,"name":"Judy Garland","photo":"https://placebear.com/352/472"}, {"id":38744009,"name":"Julia Roberts","photo":"https://placebear.com/331/441"}, {"id":46032709,"name":"Julianne Moore","photo":"https://placebear.com/331/402"}, {"id":63172387,"name":"Julie Andrews","photo":"https://placebear.com/320/416"}, {"id":28367735,"name":"Kate Winslet","photo":"https://placebear.com/329/432"}, {"id":31109338,"name":"Katharine Hepburn","photo":"https://placebear.com/366/475"}, {"id":81511778,"name":"Kathy Bates","photo":"https://placebear.com/387/440"}, {"id":58030620,"name":"Kevin Spacey","photo":"https://placebear.com/321/425"}, {"id":96645151,"name":"Leonardo DiCaprio","photo":"https://placebear.com/347/495"}, {"id":57846776,"name":"Luise Rainer","photo":"https://placebear.com/311/448"}, {"id":26406570,"name":"Marilyn Monroe","photo":"https://placebear.com/305/441"}, {"id":17017025,"name":"Matt Damon","photo":"https://placebear.com/306/421"}, {"id":84422863,"name":"Mel Gibson","photo":"https://placebear.com/301/484"}, {"id":26357464,"name":"Meryl Streep","photo":"https://placebear.com/343/401"}, {"id":87469606,"name":"Michael Caine","photo":"https://placebear.com/309/481"}, {"id":50738795,"name":"Michael Douglas","photo":"https://placebear.com/393/496"}, {"id":61071401,"name":"Morgan Freeman","photo":"https://placebear.com/348/448"}, {"id":28005840,"name":"Natalie Portman","photo":"https://placebear.com/323/448"}, {"id":50786809,"name":"Natalie Wood","photo":"https://placebear.com/386/458"}, {"id":40122578,"name":"Nicolas Cage","photo":"https://placebear.com/319/481"}, {"id":75794861,"name":"Nicole Kidman","photo":"https://placebear.com/375/443"}, {"id":81504488,"name":"Olivia de Havilland","photo":"https://placebear.com/388/450"}, {"id":43406362,"name":"Paul Newman","photo":"https://placebear.com/335/456"}, {"id":44428849,"name":"Peter O'Toole","photo":"https://placebear.com/313/467"}, {"id":60338818,"name":"Philip Seymour Hoffman","photo":"https://placebear.com/389/458"}, {"id":56249953,"name":"Ralph Fiennes","photo":"https://placebear.com/301/467"}, {"id":33056256,"name":"Robert De Niro","photo":"https://placebear.com/339/439"}, {"id":36150440,"name":"Robert Downey Jr.","photo":"https://placebear.com/393/409"}, {"id":55284258,"name":"Robert Duvall","photo":"https://placebear.com/310/472"}, {"id":49032807,"name":"Robert Redford","photo":"https://placebear.com/326/443"}, {"id":14332961,"name":"Russell Crowe","photo":"https://placebear.com/336/436"}, {"id":47048008,"name":"Sally Field","photo":"https://placebear.com/301/452"}, {"id":64664156,"name":"Samuel L. Jackson","photo":"https://placebear.com/364/491"}, {"id":63841892,"name":"Sean Penn","photo":"https://placebear.com/344/496"}, {"id":80868139,"name":"Shirley MacLaine","photo":"https://placebear.com/389/475"}, {"id":22571419,"name":"Sigourney Weaver","photo":"https://placebear.com/304/464"}, {"id":23127852,"name":"Sissy Spacek","photo":"https://placebear.com/318/427"}, {"id":91913599,"name":"Sophia Loren","photo":"https://placebear.com/360/476"}, {"id":34324158,"name":"Steve Buscemi","photo":"https://placebear.com/367/467"}, {"id":54027019,"name":"Susan Hayward","photo":"https://placebear.com/376/476"}, {"id":49932101,"name":"Susan Sarandon","photo":"https://placebear.com/335/480"}, {"id":28040377,"name":"Tom Cruise","photo":"https://placebear.com/305/482"}, {"id":34061331,"name":"Tom Hanks","photo":"https://placebear.com/344/424"}, {"id":24724551,"name":"Tommy Lee Jones","photo":"https://placebear.com/315/465"}, {"id":27085641,"name":"Viola Davis","photo":"https://placebear.com/368/481"}, {"id":91326710,"name":"Vivien Leigh","photo":"https://placebear.com/388/435"}, {"id":68598976,"name":"Willem Dafoe","photo":"https://placebear.com/347/447"} ]
actors = [{'id': 26073614, 'name': 'Al Pacino', 'photo': 'https://placebear.com/342/479'}, {'id': 77394988, 'name': 'Anthony Hopkins', 'photo': 'https://placebear.com/305/469'}, {'id': 44646271, 'name': 'Audrey Hepburn', 'photo': 'https://placebear.com/390/442'}, {'id': 85626345, 'name': 'Barbara Stanwyck', 'photo': 'https://placebear.com/399/411'}, {'id': 57946467, 'name': 'Barbra Streisand', 'photo': 'https://placebear.com/328/490'}, {'id': 44333164, 'name': 'Ben Kingsley', 'photo': 'https://placebear.com/399/442'}, {'id': 91171557, 'name': 'Bette Davis', 'photo': 'https://placebear.com/318/496'}, {'id': 25163439, 'name': 'Brad Pitt', 'photo': 'https://placebear.com/359/430'}, {'id': 59236719, 'name': 'Cate Blanchett', 'photo': 'https://placebear.com/346/407'}, {'id': 35491900, 'name': 'Christian Bale', 'photo': 'https://placebear.com/363/440'}, {'id': 48725048, 'name': 'Christoph Waltz', 'photo': 'https://placebear.com/356/445'}, {'id': 36858988, 'name': 'Christopher Walken', 'photo': 'https://placebear.com/328/448'}, {'id': 77052052, 'name': 'Clint Eastwood', 'photo': 'https://placebear.com/311/428'}, {'id': 74729990, 'name': 'Daniel Day-Lewis', 'photo': 'https://placebear.com/393/480'}, {'id': 75495971, 'name': 'Denzel Washington', 'photo': 'https://placebear.com/392/471'}, {'id': 49842505, 'name': 'Diane Keaton', 'photo': 'https://placebear.com/310/462'}, {'id': 16533679, 'name': 'Dustin Hoffman', 'photo': 'https://placebear.com/306/425'}, {'id': 77778079, 'name': 'Ed Harris', 'photo': 'https://placebear.com/365/430'}, {'id': 62340777, 'name': 'Edward Norton', 'photo': 'https://placebear.com/356/486'}, {'id': 45282572, 'name': 'Elizabeth Taylor', 'photo': 'https://placebear.com/338/440'}, {'id': 98253023, 'name': 'Ellen Burstyn', 'photo': 'https://placebear.com/313/452'}, {'id': 14389118, 'name': 'Emma Thompson', 'photo': 'https://placebear.com/314/445'}, {'id': 85245270, 'name': 'Faye Dunaway', 'photo': 'https://placebear.com/352/495'}, {'id': 77497258, 'name': 'Frances McDormand', 'photo': 'https://placebear.com/368/404'}, {'id': 69175505, 'name': 'Gary Oldman', 'photo': 'https://placebear.com/380/468'}, {'id': 52103198, 'name': 'Gene Hackman', 'photo': 'https://placebear.com/326/464'}, {'id': 53511355, 'name': 'George Clooney', 'photo': 'https://placebear.com/350/405'}, {'id': 46135141, 'name': 'Glenn Close', 'photo': 'https://placebear.com/318/446'}, {'id': 67466115, 'name': 'Grace Kelly', 'photo': 'https://placebear.com/396/422'}, {'id': 32111872, 'name': 'Greer Garson', 'photo': 'https://placebear.com/331/464'}, {'id': 38069638, 'name': 'Greta Garbo', 'photo': 'https://placebear.com/344/467'}, {'id': 30546602, 'name': 'Harrison Ford', 'photo': 'https://placebear.com/324/471'}, {'id': 78852790, 'name': 'Harvey Keitel', 'photo': 'https://placebear.com/302/498'}, {'id': 75916952, 'name': 'Heath Ledger', 'photo': 'https://placebear.com/354/420'}, {'id': 44647231, 'name': 'Helen Mirren', 'photo': 'https://placebear.com/390/401'}, {'id': 98319284, 'name': 'Hilary Swank', 'photo': 'https://placebear.com/334/428'}, {'id': 73307095, 'name': 'Holly Hunter', 'photo': 'https://placebear.com/388/439'}, {'id': 65927229, 'name': 'Ian McKellen', 'photo': 'https://placebear.com/359/447'}, {'id': 84415199, 'name': 'Ingrid Bergman', 'photo': 'https://placebear.com/341/487'}, {'id': 28676619, 'name': 'Jack Nicholson', 'photo': 'https://placebear.com/335/461'}, {'id': 66339602, 'name': 'Jane Fonda', 'photo': 'https://placebear.com/323/471'}, {'id': 22447589, 'name': 'Jane Wyman', 'photo': 'https://placebear.com/373/469'}, {'id': 52907687, 'name': 'Javier Bardem', 'photo': 'https://placebear.com/366/421'}, {'id': 35506267, 'name': 'Jeff Bridges', 'photo': 'https://placebear.com/388/422'}, {'id': 16807306, 'name': 'Jennifer Jones', 'photo': 'https://placebear.com/333/498'}, {'id': 63521043, 'name': 'Jessica Lange', 'photo': 'https://placebear.com/309/413'}, {'id': 91132400, 'name': 'Joan Crawford', 'photo': 'https://placebear.com/322/437'}, {'id': 74127064, 'name': 'Joan Fontaine', 'photo': 'https://placebear.com/329/458'}, {'id': 30283700, 'name': 'Joaquin Phoenix', 'photo': 'https://placebear.com/316/452'}, {'id': 40834926, 'name': 'Jodie Foster', 'photo': 'https://placebear.com/307/439'}, {'id': 59676726, 'name': 'Joe Pesci', 'photo': 'https://placebear.com/388/434'}, {'id': 18959030, 'name': 'Johnny Depp', 'photo': 'https://placebear.com/337/422'}, {'id': 19220801, 'name': 'Judi Dench', 'photo': 'https://placebear.com/397/480'}, {'id': 41880845, 'name': 'Judy Garland', 'photo': 'https://placebear.com/352/472'}, {'id': 38744009, 'name': 'Julia Roberts', 'photo': 'https://placebear.com/331/441'}, {'id': 46032709, 'name': 'Julianne Moore', 'photo': 'https://placebear.com/331/402'}, {'id': 63172387, 'name': 'Julie Andrews', 'photo': 'https://placebear.com/320/416'}, {'id': 28367735, 'name': 'Kate Winslet', 'photo': 'https://placebear.com/329/432'}, {'id': 31109338, 'name': 'Katharine Hepburn', 'photo': 'https://placebear.com/366/475'}, {'id': 81511778, 'name': 'Kathy Bates', 'photo': 'https://placebear.com/387/440'}, {'id': 58030620, 'name': 'Kevin Spacey', 'photo': 'https://placebear.com/321/425'}, {'id': 96645151, 'name': 'Leonardo DiCaprio', 'photo': 'https://placebear.com/347/495'}, {'id': 57846776, 'name': 'Luise Rainer', 'photo': 'https://placebear.com/311/448'}, {'id': 26406570, 'name': 'Marilyn Monroe', 'photo': 'https://placebear.com/305/441'}, {'id': 17017025, 'name': 'Matt Damon', 'photo': 'https://placebear.com/306/421'}, {'id': 84422863, 'name': 'Mel Gibson', 'photo': 'https://placebear.com/301/484'}, {'id': 26357464, 'name': 'Meryl Streep', 'photo': 'https://placebear.com/343/401'}, {'id': 87469606, 'name': 'Michael Caine', 'photo': 'https://placebear.com/309/481'}, {'id': 50738795, 'name': 'Michael Douglas', 'photo': 'https://placebear.com/393/496'}, {'id': 61071401, 'name': 'Morgan Freeman', 'photo': 'https://placebear.com/348/448'}, {'id': 28005840, 'name': 'Natalie Portman', 'photo': 'https://placebear.com/323/448'}, {'id': 50786809, 'name': 'Natalie Wood', 'photo': 'https://placebear.com/386/458'}, {'id': 40122578, 'name': 'Nicolas Cage', 'photo': 'https://placebear.com/319/481'}, {'id': 75794861, 'name': 'Nicole Kidman', 'photo': 'https://placebear.com/375/443'}, {'id': 81504488, 'name': 'Olivia de Havilland', 'photo': 'https://placebear.com/388/450'}, {'id': 43406362, 'name': 'Paul Newman', 'photo': 'https://placebear.com/335/456'}, {'id': 44428849, 'name': "Peter O'Toole", 'photo': 'https://placebear.com/313/467'}, {'id': 60338818, 'name': 'Philip Seymour Hoffman', 'photo': 'https://placebear.com/389/458'}, {'id': 56249953, 'name': 'Ralph Fiennes', 'photo': 'https://placebear.com/301/467'}, {'id': 33056256, 'name': 'Robert De Niro', 'photo': 'https://placebear.com/339/439'}, {'id': 36150440, 'name': 'Robert Downey Jr.', 'photo': 'https://placebear.com/393/409'}, {'id': 55284258, 'name': 'Robert Duvall', 'photo': 'https://placebear.com/310/472'}, {'id': 49032807, 'name': 'Robert Redford', 'photo': 'https://placebear.com/326/443'}, {'id': 14332961, 'name': 'Russell Crowe', 'photo': 'https://placebear.com/336/436'}, {'id': 47048008, 'name': 'Sally Field', 'photo': 'https://placebear.com/301/452'}, {'id': 64664156, 'name': 'Samuel L. Jackson', 'photo': 'https://placebear.com/364/491'}, {'id': 63841892, 'name': 'Sean Penn', 'photo': 'https://placebear.com/344/496'}, {'id': 80868139, 'name': 'Shirley MacLaine', 'photo': 'https://placebear.com/389/475'}, {'id': 22571419, 'name': 'Sigourney Weaver', 'photo': 'https://placebear.com/304/464'}, {'id': 23127852, 'name': 'Sissy Spacek', 'photo': 'https://placebear.com/318/427'}, {'id': 91913599, 'name': 'Sophia Loren', 'photo': 'https://placebear.com/360/476'}, {'id': 34324158, 'name': 'Steve Buscemi', 'photo': 'https://placebear.com/367/467'}, {'id': 54027019, 'name': 'Susan Hayward', 'photo': 'https://placebear.com/376/476'}, {'id': 49932101, 'name': 'Susan Sarandon', 'photo': 'https://placebear.com/335/480'}, {'id': 28040377, 'name': 'Tom Cruise', 'photo': 'https://placebear.com/305/482'}, {'id': 34061331, 'name': 'Tom Hanks', 'photo': 'https://placebear.com/344/424'}, {'id': 24724551, 'name': 'Tommy Lee Jones', 'photo': 'https://placebear.com/315/465'}, {'id': 27085641, 'name': 'Viola Davis', 'photo': 'https://placebear.com/368/481'}, {'id': 91326710, 'name': 'Vivien Leigh', 'photo': 'https://placebear.com/388/435'}, {'id': 68598976, 'name': 'Willem Dafoe', 'photo': 'https://placebear.com/347/447'}]
class MyRouter(object): def db_for_read(self, model, **hints): # if model.__name__ == 'CommonVar': if model._meta.model_name == 'commontype': return 'pgsql-ms' if model._meta.app_label == 'other': return 'pgsql-ms' # elif model._meta.app_label in ['auth', 'admin', 'contenttypes', 'sesssions', 'django_weixin', 'tagging']: # return 'default' return 'mm-ms' def db_for_write(self, model, **hints): if model._meta.model_name == 'commontype': return 'pgsql-ms' if model._meta.app_label == 'other': return 'pgsql-ms' # elif model._meta.app_label in ['auth', 'admin', 'contenttypes', 'sesssions', 'django_weixin', 'tagging']: # return 'default' return 'mm-ms'
class Myrouter(object): def db_for_read(self, model, **hints): if model._meta.model_name == 'commontype': return 'pgsql-ms' if model._meta.app_label == 'other': return 'pgsql-ms' return 'mm-ms' def db_for_write(self, model, **hints): if model._meta.model_name == 'commontype': return 'pgsql-ms' if model._meta.app_label == 'other': return 'pgsql-ms' return 'mm-ms'
Desc = cellDescClass("RF1R1WX2") Desc.properties["cell_leakage_power"] = "1118.088198" Desc.properties["dont_touch"] = "true" Desc.properties["dont_use"] = "true" Desc.properties["cell_footprint"] = "regcrw" Desc.properties["area"] = "33.264000" Desc.pinOrder = ['IQ', 'IQN', 'RB', 'RW', 'RWN', 'WB', 'WW', 'next'] Desc.add_arc("WW","WB","setup_falling") Desc.add_arc("WW","WB","hold_falling") Desc.add_arc("WW","RB","rising_edge") Desc.add_arc("WB","RB","combi") Desc.add_arc("RW","RB","three_state_disable") Desc.add_arc("RW","RB","three_state_enable") Desc.add_arc("RWN","RB","three_state_disable") Desc.add_arc("RWN","RB","three_state_enable") Desc.add_param("area",33.264000); Desc.add_pin("RW","input") Desc.add_pin("WB","input") Desc.add_pin("IQ","output") Desc.add_pin_func("IQ","unknown") Desc.add_pin("RWN","input") Desc.add_pin("next","output") Desc.add_pin_func("next","unknown") Desc.set_pin_job("WW","clock") Desc.add_pin("WW","input") Desc.add_pin("IQN","output") Desc.add_pin_func("IQN","unknown") Desc.add_pin("RB","output") Desc.add_pin_func("RB","unknown") Desc.set_job("latch") CellLib["RF1R1WX2"]=Desc
desc = cell_desc_class('RF1R1WX2') Desc.properties['cell_leakage_power'] = '1118.088198' Desc.properties['dont_touch'] = 'true' Desc.properties['dont_use'] = 'true' Desc.properties['cell_footprint'] = 'regcrw' Desc.properties['area'] = '33.264000' Desc.pinOrder = ['IQ', 'IQN', 'RB', 'RW', 'RWN', 'WB', 'WW', 'next'] Desc.add_arc('WW', 'WB', 'setup_falling') Desc.add_arc('WW', 'WB', 'hold_falling') Desc.add_arc('WW', 'RB', 'rising_edge') Desc.add_arc('WB', 'RB', 'combi') Desc.add_arc('RW', 'RB', 'three_state_disable') Desc.add_arc('RW', 'RB', 'three_state_enable') Desc.add_arc('RWN', 'RB', 'three_state_disable') Desc.add_arc('RWN', 'RB', 'three_state_enable') Desc.add_param('area', 33.264) Desc.add_pin('RW', 'input') Desc.add_pin('WB', 'input') Desc.add_pin('IQ', 'output') Desc.add_pin_func('IQ', 'unknown') Desc.add_pin('RWN', 'input') Desc.add_pin('next', 'output') Desc.add_pin_func('next', 'unknown') Desc.set_pin_job('WW', 'clock') Desc.add_pin('WW', 'input') Desc.add_pin('IQN', 'output') Desc.add_pin_func('IQN', 'unknown') Desc.add_pin('RB', 'output') Desc.add_pin_func('RB', 'unknown') Desc.set_job('latch') CellLib['RF1R1WX2'] = Desc
def compareTriplets(a, b): alice = 0 bob = 0 for i, j in zip(a, b): if i > j: alice += 1 elif i < j: bob += 1 return alice, bob
def compare_triplets(a, b): alice = 0 bob = 0 for (i, j) in zip(a, b): if i > j: alice += 1 elif i < j: bob += 1 return (alice, bob)
# a single 3 input neuron inputs = [1, 2, 3] weights = [0.2, 0.8, -0.5] bias = 2 output = (inputs[0] * weights[0] + inputs[1] * weights[1] + inputs[2] * weights[2] + bias) print(output)
inputs = [1, 2, 3] weights = [0.2, 0.8, -0.5] bias = 2 output = inputs[0] * weights[0] + inputs[1] * weights[1] + inputs[2] * weights[2] + bias print(output)
''' Adaptable File containing all relevant information everything that could be used to customise the app for redeployment ''' # file path to log file is '/CA3/sys.log' def return_local_location() -> str: ''' Return a string of the local city. To change your local city name change the returned string: ''' return 'Exeter' def return_html_filename() -> str: ''' Return the filename of the HTML if filename of the HTML file is changed, change it here: change the name of the returned string to be the filename ''' return 'index.html' def return_weather_api_key() -> str: ''' Return API Key for the Weather API To insert your own API Key, change the return value, to a string containing just your API key''' return '' def return_news_api_key() -> str: ''' Return API Key for the News API To insert your own API Key, change the return value, to a string containing just your API key''' return '' def return_weather_url() -> str: ''' Return the base URL for the weather API If base URL ever changes, replace returned string with new URL ''' return 'http://api.openweathermap.org/data/2.5/weather?' def return_news_url() -> str: ''' Return the base URL for the news API If base URL ever changes, replace returned string with new URL ''' return 'http://newsapi.org/v2/top-headlines?'
""" Adaptable File containing all relevant information everything that could be used to customise the app for redeployment """ def return_local_location() -> str: """ Return a string of the local city. To change your local city name change the returned string: """ return 'Exeter' def return_html_filename() -> str: """ Return the filename of the HTML if filename of the HTML file is changed, change it here: change the name of the returned string to be the filename """ return 'index.html' def return_weather_api_key() -> str: """ Return API Key for the Weather API To insert your own API Key, change the return value, to a string containing just your API key""" return '' def return_news_api_key() -> str: """ Return API Key for the News API To insert your own API Key, change the return value, to a string containing just your API key""" return '' def return_weather_url() -> str: """ Return the base URL for the weather API If base URL ever changes, replace returned string with new URL """ return 'http://api.openweathermap.org/data/2.5/weather?' def return_news_url() -> str: """ Return the base URL for the news API If base URL ever changes, replace returned string with new URL """ return 'http://newsapi.org/v2/top-headlines?'
''' A 2d grid map of m rows and n columns is initially filled with water. We may perform an `addLand` operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example: Given m = 3, n = 3, positions = [[0,0], [0,1], [1,2], [2,1]]. Initially, the 2d grid grid is filled with water. (Assume 0 represents water and 1 represents land). 0 0 0 0 0 0 0 0 0 Operation #1: addLand(0, 0) turns the water at grid[0][0] into a land. 1 0 0 0 0 0 Number of islands = 1 0 0 0 Operation #2: addLand(0, 1) turns the water at grid[0][1] into a land. 1 1 0 0 0 0 Number of islands = 1 0 0 0 Operation #3: addLand(1, 2) turns the water at grid[1][2] into a land. 1 1 0 0 0 1 Number of islands = 2 0 0 0 Operation #4: addLand(2, 1) turns the water at grid[2][1] into a land. 1 1 0 0 0 1 Number of islands = 3 0 1 0 We return the result as an array: [1, 1, 2, 3] SOLUTION: Case 1: The new found land has no neighbouring land vertices at all. In this case, num_islands++ since this is a new island of its own. Case 2: The new land has just 1 neighbouring land vertex. That means it will be merged into that island. Meaning no change in num_islands. Case 2: 2 or more neighbouring lands. In this case, it might happen that those 2 vertices are connected using some other path. Or it can happen that they are not connected. If they are connected already, then it means no change in num_islands. However, if they were not connected, then num_islands--. So, for this problem, we'll need to know whether any 2 land vertices are connected already or not. Which means we can use union-find. For every new-land, just union all the neighbouring land vertices together with this new land vertex. At the end, just return the number of disjoint sets. '''
""" A 2d grid map of m rows and n columns is initially filled with water. We may perform an `addLand` operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example: Given m = 3, n = 3, positions = [[0,0], [0,1], [1,2], [2,1]]. Initially, the 2d grid grid is filled with water. (Assume 0 represents water and 1 represents land). 0 0 0 0 0 0 0 0 0 Operation #1: addLand(0, 0) turns the water at grid[0][0] into a land. 1 0 0 0 0 0 Number of islands = 1 0 0 0 Operation #2: addLand(0, 1) turns the water at grid[0][1] into a land. 1 1 0 0 0 0 Number of islands = 1 0 0 0 Operation #3: addLand(1, 2) turns the water at grid[1][2] into a land. 1 1 0 0 0 1 Number of islands = 2 0 0 0 Operation #4: addLand(2, 1) turns the water at grid[2][1] into a land. 1 1 0 0 0 1 Number of islands = 3 0 1 0 We return the result as an array: [1, 1, 2, 3] SOLUTION: Case 1: The new found land has no neighbouring land vertices at all. In this case, num_islands++ since this is a new island of its own. Case 2: The new land has just 1 neighbouring land vertex. That means it will be merged into that island. Meaning no change in num_islands. Case 2: 2 or more neighbouring lands. In this case, it might happen that those 2 vertices are connected using some other path. Or it can happen that they are not connected. If they are connected already, then it means no change in num_islands. However, if they were not connected, then num_islands--. So, for this problem, we'll need to know whether any 2 land vertices are connected already or not. Which means we can use union-find. For every new-land, just union all the neighbouring land vertices together with this new land vertex. At the end, just return the number of disjoint sets. """
str1=str(input("Enter an unbalanced bracket sequence:")) op=0 #number of open brackets clo=0 #number of closed brackets #for calculating open and closed brackets for i in range(0,len(str1)): if (str1[i]=="("): op=op+1 if (str1[i]==")"): clo=clo+1 if (op==clo): x = "(" + str1 + ")" stack=[] #list to add open brackets #checinkg if x is balanced or not for i in range(0,len(x)): if(x[i]=="(") : stack.append("(") else: if(len(stack)!=0): stack.remove("(") #finding open bracket for closed bracket and removing it from stack if (len(stack)==0): #checking if all opening brackets have closed brackets print("YES") else: print("NO") else: print("NO")
str1 = str(input('Enter an unbalanced bracket sequence:')) op = 0 clo = 0 for i in range(0, len(str1)): if str1[i] == '(': op = op + 1 if str1[i] == ')': clo = clo + 1 if op == clo: x = '(' + str1 + ')' stack = [] for i in range(0, len(x)): if x[i] == '(': stack.append('(') elif len(stack) != 0: stack.remove('(') if len(stack) == 0: print('YES') else: print('NO') else: print('NO')
Rainbow = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'] print("the first element of the list Rainbow is:",Rainbow[0]) print("The true colors of a rainbow are:") for i in range(len(Rainbow)): print(Rainbow[i]) #print all the elements in one line or one item per line. Here are two examples of that, using other forms of loop: a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] #1 print(a) for i in range(len(a)): print(a[i])#2 for elem in a: print(elem, end = ' ') #3
rainbow = ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'] print('the first element of the list Rainbow is:', Rainbow[0]) print('The true colors of a rainbow are:') for i in range(len(Rainbow)): print(Rainbow[i]) a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] print(a) for i in range(len(a)): print(a[i]) for elem in a: print(elem, end=' ')