Sep-28-2020, 09:51 PM
(This post was last modified: Sep-28-2020, 10:08 PM by SalsaBeanDip.)
I am writing a function that will convert a sentence to pig latin. To do this, I convert all the letters to uppercase, remove the first letter and place it at the end of the word, and then add "AY" to the end of the word. So, "Stop and smell the roses." will become "TOPSAY NDAAY MELLSAY HEAY OSESRAY.” I can't seem to get my code to work though, it only prints out "OSESRAY". How can I fix my program?
Hello everyone I was able to fix it
def pigLatin(): user_string = input('Enter a string: ') user_string = user_string.upper() ay = 'AY' user_string = user_string.split() for item in user_string: result_pig = item[1:(len(user_string))] + item[0] + ay + ' ' print(result_pig)
Hello everyone I was able to fix it