Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def pig_it (string) :
origin_list_split_string = string.split ( )
final_list = []
for words in origin_list_split_string :
if len(words) > 1 :
final_list.append(words[1::] + words[0] + "ay")
else :
if words.isalnum() == False:
final_list.append(words)
else :
final_list.append(words + "ay")
pig_string = (" ").join(final_list)
return pig_string
string = input ("Enter a string :")
print (pig_it(string))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment