-1

我正在尝试使用猪拉丁式设置。辅音的规则是取字符串的第一个字母,将其移到末尾并添加ay。我的问题是我要删除第一个字母并将其移到末尾...我不确定如何同时执行此操作。谢谢你。

pyg = 'ay'

   original = raw_input('Enter a word:')
   word = original.`enter code here`lower()
   first = original[0]
   if len(original) > 0 and original.isalpha():
    if first == "a" or "e" or "i" or "o" or "u" or "A" or "E" or "I" or "O" or "U":
        print("vowel")
        new_word = original.append(pyg)
    else:
        print("consonant")
        new_word = (word.pop[0] and word.append(word[0]) + str(pyg)
    print original
   else:
    print 'empty'
4

1 回答 1

2

像这样?

new_word = word[1:] + word[0] + pyg
于 2013-01-12T18:33:28.133 回答