Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created July 26, 2021 07:45
Show Gist options
  • Save amankharwal/01912e1225f981fb3f30b3f665c36882 to your computer and use it in GitHub Desktop.
Save amankharwal/01912e1225f981fb3f30b3f665c36882 to your computer and use it in GitHub Desktop.
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