Skip to content

Instantly share code, notes, and snippets.

@joan0fsnark
Created September 6, 2021 20:00
Show Gist options
  • Save joan0fsnark/065bce88d7942cc5a65bd8eaa9d6c7f2 to your computer and use it in GitHub Desktop.
Save joan0fsnark/065bce88d7942cc5a65bd8eaa9d6c7f2 to your computer and use it in GitHub Desktop.
Takes in two words and returns the two with first letters swapped
# Write your make_spoonerism function here:
def make_spoonerism(word1, word2):
return word2[0] + word1[1:]+" "+word1[0] + word2[1:]
# Uncomment these function calls to test your function:
print(make_spoonerism("Codecademy", "Learn"))
# should print Lodecademy Cearn
print(make_spoonerism("Hello", "world!"))
# should print wello Horld!
print(make_spoonerism("a", "b"))
# should print b a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment