Advertisement
UF6

2.5 Problem 9

UF6
Jul 4th, 2016
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. import itertools, re
  2. #import vigenereCipher, pyperclip,freqAnalysis,deectEnglish
  3. alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  4. silentmode=False
  5. nummostusedletters=5
  6. maxkeylength=5
  7.  
  8. def removeSpaces(message):
  9.     newMessage = ""
  10.     for letter in message:
  11.         if letter == ' ':
  12.             pass
  13.         else:
  14.             newMessage += letter
  15.     return newMessage
  16.  
  17. def main():
  18.     cipher="PVVWA MKAZS TDUDK UJURB KZPMH DYMXS KUYQZ"
  19.     cipher += "BDSIU OHPA HVDIW EQPVV WAMNA"
  20.     cipher+="NRKTE BXECY LXZUV FWPZF YCDBH WTMPS UTKKV HAFZR"
  21.     cipher+="PVVWA MNANR ZEHCE SAFKT WBKTA AVEOO XQEHJ QHTWA"
  22.     cipher+="NHYQJ HYQPS TTJWH GARVE YFZNA RZZPV ZEYVR BPSIN"
  23.     cipher+="NSRWO RFIJP LFDCN OKICP PKFOK FIQOD FZZSE FOFVY"
  24.     cipher+="ZKVXH CEQSO PFKRF UPAZS DHSQP CRSNS VFDOK FDSBQ"
  25.     cipher+="UKFDZ WJFDS VZPWI QPSOF KTKTA RVOHO IMPWF ZKTZZ W"
  26.     cipher = removeSpaces(cipher)
  27.     print(cipher)
  28.     searchStr = "KU"
  29.     loc = cipher.find(searchStr)
  30.     while loc>0:
  31.         print(loc)
  32.         loc = cipher.find(searchStr, loc+1)
  33.        
  34.    
  35. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement