-
-
Save amankharwal/01912e1225f981fb3f30b3f665c36882 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def swap_letters(message): | |
letter_list = [] | |
if not is_even(len(message)): | |
message = message + 'x' | |
even_letters = get_even_letters(message) | |
odd_letters = get_odd_letters(message) | |
for counter in range(0, int(len(message)/2)): | |
letter_list.append(odd_letters[counter]) | |
letter_list.append(even_letters[counter]) | |
new_message = ''.join(letter_list) | |
return new_message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment