MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / decrypt

Function decrypt

TextEncryptor/TextEncryptor.py:17–30  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

15 return result
16
17def decrypt(text):
18 result = ""
19
20 for i in range(len(text)):
21 char = text[i]
22
23 if char.isupper():
24 result += chr((ord(char) - decryptkey - 65) % 26 + 65)
25 elif char.islower():
26 result += chr((ord(char) - decryptkey - 97) % 26 + 97)
27 else:
28 result += char
29
30 return result
31
32
33choice = int(input("Would you like to encrypt some text or decrypt some text? Choose 1 to encrypt and 2 to decrypt "))

Callers 1

TextEncryptor.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected