g-stoyanov Feb 12th, 2016 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- from string import ascii_uppercase, ascii_lowercase
- k = int(input())
- inputStr = input()
- result = ""
- for i in range(0, len(inputStr)):
- if ord(inputStr[i]) > 64 and ord(inputStr[i]) < 92:
- encryptedPos = (ord(inputStr[i]) - 65) + k
- encryptedIndex = encryptedPos if encryptedPos < len(ascii_uppercase) else encryptedPos - len(ascii_uppercase)
- result += ascii_uppercase[encryptedIndex]
- elif inputStr[i] in ascii_lowercase:
- result = "INVALID INPUT"
- result += inputStr[i]
- print("INVALID INPUT")
RAW Paste Data