Fix: Ensure all skills are tracked as files, not submodules
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
def encrypt(s):
|
||||
"""Create a function encrypt that takes a string as an argument and
|
||||
returns a string encrypted with the alphabet being rotated.
|
||||
The alphabet should be rotated in a manner such that the letters
|
||||
shift down by two multiplied to two places.
|
||||
For example:
|
||||
encrypt('hi') returns 'lm'
|
||||
encrypt('asdfghjkl') returns 'ewhjklnop'
|
||||
encrypt('gf') returns 'kj'
|
||||
encrypt('et') returns 'ix'
|
||||
"""
|
||||
result = ""
|
||||
for char in s:
|
||||
if char.isalpha():
|
||||
shift = 2 * 2 # two multiplied to two = 4
|
||||
if char.islower():
|
||||
new_char = chr((ord(char) - ord('a') + shift) % 26 + ord('a'))
|
||||
else:
|
||||
new_char = chr((ord(char) - ord('A') + shift) % 26 + ord('A'))
|
||||
result += new_char
|
||||
else:
|
||||
result += char
|
||||
return result
|
||||
Reference in New Issue
Block a user