我想做一个猪拉丁翻译。你知道吗
translate_sentence(" No shirts, no shoes, no service")
应该产生:
Onay irtsshay, onay oesshay, onay ervicesay
这是我的密码:
sentence = sentence.split()
for item in range(len(sentence)):
if sentence[item][0] in "aeiou":
sentence[item] += 'yay'
else:
sentence[item]=sentence[item][1:]+sentence[item][0]
sentence[item]+='ay'
sentence = ' '.join(sentence)
print(sentence)
很酷的挑战,以下是我的解决方案:
输出:
相关问题 更多 >
编程相关推荐