Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. def unscrambler():
  2.  
  3.     import linecache
  4.     import sys
  5.    
  6.     code = input("Enter code:   ")
  7.    
  8.     words = code.split(';')
  9.    
  10.     s = ""
  11.    
  12.     for i in words:
  13.    
  14.         for x in range(1, 62076):
  15.            
  16.             line = linecache.getline('dictionary.txt', x)
  17.             line = line.replace("\n", "")
  18.            
  19.             if len(line) == len(i):
  20.  
  21.                 lineL = list(line)
  22.                 iL = list(i)
  23.                
  24.                 klok = len(line)
  25.                
  26.                
  27.                 for d in range(1, (klok+1)):
  28.                     quitador(lineL, iL)
  29.                    
  30.                
  31.                 if len(lineL) == 0 and len(iL) == 0:
  32.                     s = s + line + ";"
  33.  
  34.     print("unscrambled: " + s)
  35.  
  36.                
  37. def quitador(lineL, iL):
  38.    
  39.     hasDeleted = 0
  40.    
  41.     for j in range(0, len(lineL)):
  42.        
  43.         if (not hasDeleted):
  44.             if (iL[0] == lineL[j]):
  45.                 del iL[0]
  46.                 del lineL[j]
  47.                 hasDeleted = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement