-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1_shiftletter.py
More file actions
executable file
·33 lines (25 loc) · 936 Bytes
/
1_shiftletter.py
File metadata and controls
executable file
·33 lines (25 loc) · 936 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
31
#!/usr/bin/python
from string import lowercase
def shift2right (line,shift):
"""
Shifts the letter a given number
"""
outline = ""
for char in line:
<<<<<<< HEAD
decimal = (ord(char) + shift) % 26 # convert letter into decimal and shift
char = chr(decimal ) # convert the decimal back into char
outline += str(char) # append the result to a string
=======
decimal = (ord(char) + shift) % 122 # convert letter into decimal and shift
if decimal < 97: #if ascii < 97 (uppercase and other prints)
decimal += 96 #shift them
char = chr(decimal) # convert the decimal back into char
outline += str(char) # append the result to a string
>>>>>>> a48bcea0b89de477057ca4664b02377cf78f22ac
return(outline)
theline = raw_input()
#convert to string
str(theline)
shifted = shift2toright(theline,2)
print shifted