@MiroslawJaniewicz/

scoreSettler2.py

Python 2.7

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.17675085235341914","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZGVmIHNvcnRlcihhcj1bXSwgcmV2ZXJzZT1GYWxzZSk6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICBpID0gMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgd2hpbGUgaSA8PSBsZW4oYXIpOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICBjaGFuZ2UgPSBGYWxzZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgdHJ5OiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICB4ID0gYXJbaV0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgeSA9IGFyW2krMV0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgIGlmIG5vdCByZXZlcnNlIGFuZCB4ID4geTogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgYXJbaV0gPSB5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIGFyW2krMV0gPSB4ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBjaGFuZ2UgPSBUcnVlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICBlbGlmIHJldmVyc2UgYW5kIHggPCB5OiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBhcltpXSA9IHkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgYXJbaSsxXSA9IHggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgIGNoYW5nZSA9IFRydWUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgZWxzZTogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgaSArPSAxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgaWYgY2hhbmdlIGFuZCBpID4gMDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpID0gMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgIGV4Y2VwdCBJbmRleEVycm9yOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgYnJlYWsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICByZXR1cm4gYXIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCmRlZiBzY29yZVNldHRsZXIoYXI9W10sIG1heHM9MCk6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgciA9IHNvcnRlcihhciwgcmV2ZXJzZT1UcnVlKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgIHJldHVybiBbeCBmb3IgeCBpbiByIGlmIHggPD0gbWF4c10gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAphciA9IFsxMDAsIDMzMzMzMzMsIDg3OTIwMCwgMTE3MjEwMCwgMTE0MTgwMCwgOTMzOTAwLCAxMTc3MjAwLCAxMTkwMjAwLCAxMTEwMTAwLCAKICAgICAgMTE1ODQwMCwgOTg1NjAwLCAxMDQ3MjAwLCAxMDQ5MTAwLCAxMTM4NjAwLCAxMTcwNTAwLCAxMDY0NTAwLCAxMTkwMDAwLCAgICAgICAgCiAgICAgIDEwNTAyMDAsIDEwOTA0MDAsIDEwNjI4MDAsIDEwNjE3MDAsIDEyMTgwMDAsIDEwNjgwMDAsIDExMjc3MDAsIDExNDQ4MDAsICAgICAgIAogICAgICAxMTk1MTAwXSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCnByaW50IHNjb3JlU2V0dGxlcihhciwgMTIxODAwMCk="},"asBuffer":null},"loaded":true}}
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
31
32
33
34
35
def sorter(ar=[], reverse=False):                                                
    i = 0                                                                        
    while i <= len(ar):                                                          
        change = False                                                           
        try:                                                                     
            x = ar[i]                                                            
            y = ar[i+1]                                                          
            if not reverse and x > y:                                            
                ar[i] = y                                                        
                ar[i+1] = x                                                      
                change = True                                                    
            elif reverse and x < y:                                              
                    ar[i] = y                                                    
                    ar[i+1] = x                                                  
                    change = True                                                
            else:                                                                
                    i += 1                                                       
                                                                                 
            if change and i > 0:                                                 
                i = 0                                                            
        except IndexError:                                                       
            break                                                                
    return ar                                                                    
                                                                                 
                                                                                    
def scoreSettler(ar=[], maxs=0):                                                 
    r = sorter(ar, reverse=True)                                                 
    return [x for x in r if x <= maxs]                                              
                                                                                    
ar = [100, 3333333, 879200, 1172100, 1141800, 933900, 1177200, 1190200, 1110100, 
      1158400, 985600, 1047200, 1049100, 1138600, 1170500, 1064500, 1190000,        
      1050200, 1090400, 1062800, 1061700, 1218000, 1068000, 1127700, 1144800,       
      1195100]                                                                      
                                                                                    
print scoreSettler(ar, 1218000)