Skip to content

Instantly share code, notes, and snippets.

@kenechukwu-2
Created July 22, 2018 19:39
Show Gist options
  • Save kenechukwu-2/bbb94c121cda4e55a43b6b282f1d3af2 to your computer and use it in GitHub Desktop.
Save kenechukwu-2/bbb94c121cda4e55a43b6b282f1d3af2 to your computer and use it in GitHub Desktop.
"""if ord('a') == 97:
print ("true")
else:
print("not true")"""
encrypted = []
sentence = input("Enter characters to encrypt or decrypt")
for p in sentence:
if ord(p) == 51:
p = ord(p) + 15
encrypted.append(chr(p))
elif ord(p) == 66:
p = ord(p) - 15
encrypted.append(chr(p))
elif ord(p) == 42:
p = ord(p) + 29
encrypted.append(chr(p))
elif ord(p) == 71:
p = ord(p) - 29
encrypted.append(chr(p))
elif ord(p) == 48:
p = ord(p) + 7
encrypted.append(chr(p))
elif ord(p) == 55:
p = ord(p) - 7
encrypted.append(chr(p))
elif ord(p) == 37:
p = ord(p) + 26
encrypted.append(chr(p))
elif ord(p) == 63:
p = ord(p) - 26
encrypted.append(chr(p))
elif ord(p) == 45:
p = ord(p) + 15
encrypted.append(chr(p))
elif ord(p) == 60:
p = ord(p) - 15
encrypted.append(chr(p))
elif ord(p) == 35:
p = ord(p) + 29
encrypted.append(chr(p))
elif ord(p) == 64:
p = ord(p) - 29
encrypted.append(chr(p))
elif ord(p) == 66:
p = ord(p) - 15
encrypted.append(chr(p))
elif ord(p) == 32:
p = ord(p) + 25
encrypted.append(chr(p))
elif ord(p) == 57:
p = ord(p) - 25
encrypted.append(chr(p))
elif ord(p) == 38:
p = ord(p) + 27
encrypted.append(chr(p))
elif ord(p) == 65:
p = ord(p) - 27
encrypted.append(chr(p))
elif ord(p) == 49:
p = ord(p) + 21
encrypted.append(chr(p))
elif ord(p) == 70:
p = ord(p) - 21
encrypted.append(chr(p))
elif ord(p) == 47:
p = ord(p) + 9
encrypted.append(chr(p))
elif ord(p) == 56:
p = ord(p) - 9
encrypted.append(chr(p))
elif ord(p) == 44:
p = ord(p) + 8
encrypted.append(chr(p))
elif ord(p) == 52:
p = ord(p) - 8
encrypted.append(chr(p))
elif ord(p) == 36:
p = ord(p) + 31
encrypted.append(chr(p))
elif ord(p) == 67:
p = ord(p) - 31
encrypted.append(chr(p))
elif ord(p) == 43:
p = ord(p) + 25
encrypted.append(chr(p))
elif ord(p) == 68:
p = ord(p) - 25
encrypted.append(chr(p))
elif ord(p) == 39:
p = ord(p) + 22
encrypted.append(chr(p))
elif ord(p) == 59:
p = ord(p) + 10
encrypted.append(chr(p))
elif ord(p) == 69:
p = ord(p) - 10
encrypted.append(chr(p))
elif ord(p) == 33:
p = ord(p) + 20
encrypted.append(chr(p))
elif ord(p) == 53:
p = ord(p) - 20
encrypted.append(chr(p))
elif ord(p) == 34:
p = ord(p) + 20
encrypted.append(chr(p))
elif ord(p) == 54:
p = ord(p) - 20
encrypted.append(chr(p))
elif ord(p) == 58:
p = ord(p) + 4
encrypted.append(chr(p))
elif ord(p) == 62:
p = ord(p) - 4
encrypted.append(chr(p))
elif ord(p) == 40:
p = ord(p) + 24
encrypted.append(chr(p))
elif ord(p) == 46:
p = ord(p) - 24
encrypted.append(chr(p))
elif ord(p) == 41:
p = ord(p) + 9
encrypted.append(chr(p))
elif ord(p) == 50:
p = ord(p) - 9
encrypted.append(chr(p))
elif ord(p) == 72:
p = ord(p) + 31
encrypted.append(chr(p))
elif ord(p) == 103:
p = ord(p) - 31
encrypted.append(chr(p))
elif ord(p) == 82:
p = ord(p) + 27
encrypted.append(chr(p))
elif ord(p) == 109:
p = ord(p) - 27
encrypted.append(chr(p))
elif ord(p) == 87:
p = ord(p) + 11
encrypted.append(chr(p))
elif ord(p) == 98:
p = ord(p) - 11
encrypted.append(chr(p))
elif ord(p) == 79:
p = ord(p) + 26
encrypted.append(chr(p))
elif ord(p) == 105:
p = ord(p) - 26
encrypted.append(chr(p))
elif ord(p) == 84:
p = ord(p) + 27
encrypted.append(chr(p))
elif ord(p) == 111:
p = ord(p) - 27
encrypted.append(chr(p))
elif ord(p) == 75:
p = ord(p) + 25
encrypted.append(chr(p))
elif ord(p) == 100:
p = ord(p) - 25
encrypted.append(chr(p))
elif ord(p) == 81:
p = ord(p) + 23
encrypted.append(chr(p))
elif ord(p) == 104:
p = ord(p) - 23
encrypted.append(chr(p))
elif ord(p) == 86:
p = ord(p) + 21
encrypted.append(chr(p))
elif ord(p) == 107:
p = ord(p) - 21
encrypted.append(chr(p))
elif ord(p) == 83:
p = ord(p) + 12
encrypted.append(chr(p))
elif ord(p) == 95:
p = ord(p) - 12
encrypted.append(chr(p))
elif ord(p) == 78:
p = ord(p) + 16
encrypted.append(chr(p))
elif ord(p) == 94:
p = ord(p) - 16
encrypted.append(chr(p))
elif ord(p) == 85:
p = ord(p) + 12
encrypted.append(chr(p))
elif ord(p) == 97:
p = ord(p) - 12
encrypted.append(chr(p))
elif ord(p) == 91:
p = ord(p) + 11
encrypted.append(chr(p))
elif ord(p) == 102:
p = ord(p) - 11
encrypted.append(chr(p))
elif ord(p) == 89:
p = ord(p) + 21
encrypted.append(chr(p))
elif ord(p) == 110:
p = ord(p) - 21
encrypted.append(chr(p))
elif ord(p) == 90:
p = ord(p) + 9
encrypted.append(chr(p))
elif ord(p) == 99:
p = ord(p) - 9
encrypted.append(chr(p))
elif ord(p) == 88:
p = ord(p) + 20
encrypted.append(chr(p))
elif ord(p) == 108:
p = ord(p) - 20
encrypted.append(chr(p))
elif ord(p) == 92:
p = ord(p) + 9
encrypted.append(chr(p))
elif ord(p) == 101:
p = ord(p) - 9
encrypted.append(chr(p))
elif ord(p) == 80:
p = ord(p) + 26
encrypted.append(chr(p))
elif ord(p) == 106:
p = ord(p) - 26
encrypted.append(chr(p))
elif ord(p) == 77:
p = ord(p) + 16
encrypted.append(chr(p))
elif ord(p) == 93:
p = ord(p) - 16
encrypted.append(chr(p))
elif ord(p) == 73:
p = ord(p) + 3
encrypted.append(chr(p))
elif ord(p) == 76:
p = ord(p) - 3
encrypted.append(chr(p))
elif ord(p) == 74:
encrypted.append(chr(p))
elif ord(p) == 119:
p = ord(p) + 6
encrypted.append(chr(p))
elif ord(p) == 125:
p = ord(p) - 6
encrypted.append(chr(p))
elif ord(p) == 114:
p = ord(p) + 7
encrypted.append(chr(p))
elif ord(p) ==121:
p = ord(p) - 7
encrypted.append(chr(p))
elif ord(p) == 117:
p = ord(p) + 6
encrypted.append(chr(p))
elif ord(p) == 123:
p = ord(p) - 6
encrypted.append(chr(p))
elif ord(p) == 115:
p = ord(p) + 9
encrypted.append(chr(p))
elif ord(p) == 124:
p = ord(p) - 9
encrypted.append(chr(p))
elif ord(p) == 112:
p = ord(p) + 4
encrypted.append(chr(p))
elif ord(p) == 116:
p = ord(p) - 4
encrypted.append(chr(p))
elif ord(p) == 113:
p = ord(p) + 9
encrypted.append(chr(p))
elif ord(p) == 122:
p = ord(p) - 9
encrypted.append(chr(p))
elif ord(p) == 118:
p = ord(p) + 8
encrypted.append(chr(p))
elif ord(p) == 126:
p = ord(p) - 8
encrypted.append(chr(p))
elif ord(p) == 120:
encrypted.append(chr(p))
print ("".join(encrypted))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment