-2

I can't figure out what I'm doing wrong here. The shift works flawlessly excpet for it skips the first letter in the cipher code. What gives? It should translate to WELCOMETOCRYPTOGRAPHY but does ELCOME....

    cipher = 'ZGXJHZOJXMTKOJBMVKCT'
    letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

    plain = ""
    for x in cipher:
            if x in letters:
                    pos = (letters.find(x) - 21) % 26
            plain += letters[pos]
    print ("Key #%s: %s") % (c, plain)
Madou D
  • 17
  • 1

1 Answers1

-1

Your code is fine. Your cipher itself is missing the first letter. The cipher should look like RZGXJHZOJXMTKOJBMVKCT not ZGXJHZOJXMTKOJBMVKCT

NaruS
  • 168
  • 1
  • 15
Gunnar
  • 19
  • 6