Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def convert(message, offset):
- alphabet = "abcdefghijklmnopqrstuvwxyz"
- result =""
- for i in range(len(message)):
- index = -1000
- for j in range(len(alphabet)):
- if message[i].lower() == alphabet[j]:
- index = j
- if index == -1000:
- result += message[i]
- else:
- newIndex = index + offset
- if message[i] == message[i].lower():
- result += alphabet[newIndex % len(alphabet)]
- else:
- result += alphabet[newIndex % len(alphabet)].upper()
- return result
- print(convert("HelloOOO WORLDdd", -26))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement