Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- #Make Alphabet -----------------------------------------------------
- lulz = "abcdefghijklmnopqrstuvwxyz"
- letters = list(lulz)
- its = [15,6,5,7,15,4,6,9,15,2,5,5,8,13,11,2,0,10,11,5,10,2,6,4,2,2]
- zipo = zip(letters,its)
- dictionary = dict(zipo)
- def fill(letter,its):
- for i in range(its):
- letters.append(letter)
- for (x,y) in zipo:
- fill(x,y)
- random.shuffle(letters)
- #Choose Letters -----------------------------------------------------
- def randomize():
- chosen = random.sample(letters,9)
- return chosen
- chosen = randomize()
- #Sort Alphabetically ------------------------------------------------
- ordered = sorted(chosen)
- #Mostrar valores de cada letra en orden
- values = []
- for i in ordered:
- if i in dictionary:
- values.append(dictionary.get(i))
- zipo2 = zip(ordered,values)
- def compare(x,y):
- key_of_x=x[1]
- key_of_y=y[1]
- if key_of_x > key_of_y:
- return -1
- elif key_of_x < key_of_y:
- return 1
- else:
- return 0
- order_by_value = sorted(zipo2,cmp=compare)
- #Selecciona los 3 mayores
- search_terms = []
- for i in range(3):
- search_terms.append(order_by_value[i][0])
- searchTerm = search_terms[0] +search_terms[1] +search_terms[2]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement