write a Pig Latin translator
Pig Latin is a language game, where you move the first letter of the word to the end and add “ay.” So python become ythonpay. just like this.
the code
print 'Welcome to the Pig Latin translator!' name = raw_input("Enter a word:") if len(name) > 0 and name.isalpha(): #method .isalpha()which returns False since the string contains non-letter characters word = name.lower() first = word[0] new_word = word + first new_word = new_word[1:len(new_word)] print name
python 学习之 Pig Latin
最新推荐文章于 2021-05-30 16:47:15 发布