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 36 37 38 39 40 41 42 43 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 16 17:08:52 2018 @author: beast """ def version1(): a=['a','b','c','d','e'] # list 1 b=['a','b','c','d','e','f','g','h'] # list 2 c=[k for k in (a)if (k in (a) and k not in (b))] # include unique item from list 1 : items are (list1-list2)(set thoery) d=[l for l in (b) if l in (a ) and l in (b) or (l not in (a) and l in (b))] #include all the comman from list 1 and unique from list 2 lst=c+d # append above two comprehensed list to get union of list1 U list2 lst.sort() # not neccessay but makes list easy to understand (sorting in ascending order ) print("\n\na=",a) print("\n\nb=",b) print("\n\nunion=",lst) return lst # make it easy to import and use e.g import union_beast.py and then call union_beast.version1() it will return this union of list def version2(): a=['a','b','c','d','e'] # list 1 b=['d','e','f','g','h'] # list 2 c=[] for k in range (max(len(a),len(b))):# max return maximum number among two or more number so we iterate over max of length of both the list if k <len(a) and a[k] not in (b) : # if length of a is greater than current indexing and element at kth index is not present in list b (ie get List1-list 2 item) c.append(a[k]) # if item is unique to list 1 then append to result list (here c) if k <len(b) and b[k] not in (a) :# same as above logic but here we get item unique to list 2 (here list b) c.append(b[k]) # same append to result list (here c) if k <len(b) and b[k] in (a) : # now add the comman item to list (this is vital step as we only add only one instance of item that are both present in list 1 and list 2) eg if 2 is present in list 1 and list 2 we add only one 2 to result list c.append(b[k]) # append to result list (here c) c.sort() # not neccessary but make the result more eye catchy print("\n\na=",a) #print list 1 print("\n\nb=",b)#print list 2 print("\n\nunion=",c) #print the result if __name__=="__main__": # used to run the function via main loading ...i.e if the module is not imported print("\n----------by version 1------------\n") version1() print("\n\n------------by version 2------------") version2() |
1. go to blogger dashboard, select template and edit html. 2. search for </head> to add script. - you may download and upload to your site, or just use this link (no download required) script <script src='http://docs.google.com/uc?id=0B7xJbTAja8i0a0ZJbXJ2TkkwSW8&export=download' type='text/javascript'/> 2. search for ]]></b:skin> to add style/css. img.label_thumb{ float:left; padding:5px; border:1px solid #8f8f8f; background:#D2D0D0; margin-right:10px; height:55px; width:55px; } img.label_thumb:hover{ background:#f7f6f6; } .label_with_thumbs { float: left; width: 100%; min-height: 70px; margin: 0px 10px 2px 0px; adding: 0; } ul.label_with_thumbs li { padding:8px 0; min-height:65px; margin-bottom:10px; } .label_with_thumbs a {} .label_with_thumbs strong {} 2. save template. 3. add a widget. 3. edit widget. at this example i use random post with label "blogger", you must replace it with your label. <div s...
Comments
Post a Comment
share your thoughts ....