word = raw_input('Enter a word: ')
for i in word:
if i in ['a','e','i','u','A','E','I','O','o','U']:
word1 = i
break
else:
print i,
print ""
i = 0
while word[i]!=word1:
这是我遇到问题的地方。我需要保存元音前的每个字母(或者我已经尝试过的)。这是一个拉丁文翻译的开始。在这个阶段,我试图翻转前缀和其他字词。如何在while循环运行时保存每个字母
g = word[i]
i = i+1
prefix = g + word1
print prefix
例子:
input - person
output - rsonpe
input - hello
output - llohe
input - pppat
output - tpppa
input - hhhhhelllllloool
output - llllllooolhhhhhe
我翻转字母的第一个元音之前,和该单词的其余部分。
你试过追加到列表吗? – reticentroot
不,我可以在哪里用.append来做这件事? – Ele
在你的陈述。如果你写出输出的明确细节,你可能会更具体。 – reticentroot