-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcypher.py
More file actions
30 lines (24 loc) · 837 Bytes
/
Copy pathcypher.py
File metadata and controls
30 lines (24 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Back end of cypher
import collections
import string
def moduleTest(name):
print("Hello World!")
print("Hello " + name + ", how old art thu?")
def encrypt(word, rotationnum):
if word and rotationnum != "":
alphLib = collections.deque(string.ascii_lowercase)
word = word.lower()
rotationNum = int(rotationnum)
alphLib.rotate(rotationNum)
alphLib = ''.join(list(alphLib))
secret = ''
for letter in word:
if letter in string.ascii_lowercase:
position = string.ascii_lowercase.index(letter)
newletter = alphLib[position]
secret = secret + newletter
else:
secret = secret + letter
else:
secret = "Invalid Input... :("
return secret