擅长:python、mysql、java
<p>空间也很重要:</p>
<pre><code>return ''.join(letter if letter in vowels or letter == ' ' else (letter + 'o' + letter)for letter in sentence)
</code></pre>
<p>所以,代码:</p>
<pre><code>vowels = list('aeiouyäöå')
consonants = list('qwrtpsdfghjklzxcvbnm')
# if letter is a consonant then double it and out 'o' in between.
def rovarspraket(sentence):
return ''.join(letter if letter in vowels or letter == ' ' else (letter + 'o' + letter)for letter in sentence)
print(rovarspraket('hello friend'))
</code></pre>
<p>输出:</p>
<pre><code>hohelollolo fofrorienondod
</code></pre>