Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #На тесте "it's a shift cipher!" выдает x t ' k , хотя "xt'k o v" should equal "xt'k o vwixl qzswej!"
- class Vigenere(object):
- def __init__(self,key,alp):
- self.key = key
- self.alp = alp
- def encode(self,text):
- if text.lower() == text:
- r = []
- alphabet = self.alp*2
- print(alphabet)
- for i,j in zip(self.key,text):
- if j not in self.alp:
- r += j
- else:
- r += alphabet[self.alp.index(i)+self.alp.index(j)]
- return r
- return text
Advertisement
Add Comment
Please, Sign In to add comment