Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python
- import sys
- def stringintolist(str): # taking the string argument and making it a list
- cipherchar = [] # make an empty list
- cipherchar = list(str) # taking each letter
- return cipherchar # this function then spits out the list
- def CheckForCoincidences(str): # This function takes a string, creates the first test string, and letter by letter compares side by side
- # This is the counter for how many times on that line the letter is the same
- filler = '0' # This is a filler character to add to the front of the list, moving the list over
- CipherText = stringintolist(str) # Calling the list of letters CipherText for ease
- TestText = [] # creating empty TestText list
- for i in CipherText: # putting each letter from CipherText into TextText
- TestText.append(i)
- TestText.insert(0,filler) # adding the first filler to get started
- #start to compare here.
- for i in range(len(CipherText)):
- SameLetter = 0 # Set the same letter counter to 0 after each TestText change (each 'line')
- for i, j in zip(CipherText,TestText): # testing a character in that line
- if i == j: # if it's the same...
- SameLetter += 1 # add 1 to our same letter counter
- print SameLetter
- TestText.insert(0,filler) # now that we are done doing the first line, change it to be the second one.
- CheckForCoincidences(sys.argv[1]) # running the defs.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement