Guest User

Untitled

a guest
Sep 27th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. def find_best_shifts_rec(wordlist, text, start):
  2.  
  3.  
  4. message = text
  5.  
  6. for shift in xrange(0,27):
  7.  
  8. message = text[0:start] + apply_shift(text[start:len(text)], -shift)
  9. print message ### add 'print' HERE!
  10.  
  11. for i in xrange(start,len(message)+1):
  12. if is_word(wordlist, message[start:i]):
  13. if i == len(message):
  14.  
  15. return [(start, shift)]
  16. elif message[i] == ' ':
  17.  
  18. recShifts = find_best_shifts_rec(wordlist, message, i+1)
  19. if recShifts != None:
  20. return [(start, shift)] + recShifts
Advertisement
Add Comment
Please, Sign In to add comment