This could be an interesting error
Seymore4Head at Hotmail.invalid
Mon Sep 1 04:13:36 CEST 2014
On Mon, 01 Sep 2014 12:12:20 +1000, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>>>'my' doesn't contain a vowel, therefore the condition of the 'if'
>>>statement in 'pigword' is never true, therefore it never binds to the
>> Ah. The piglatin example says to use y as a vowel. I forgot to
>> include it.
>Doesn't matter. What if one of the words doesn't contain any vowel or "y"?
>E.g. "Grrr!", "Hmmm", "the nth degree", "tsk tsk", Internet slang such
>as "pwn" and "pr0n", or words in Foreign like "cwm" (pronounced "koom",
>Welsh for a cirque, which is a type of valley). You still need to deal with
>the case that a word contains no vowels at all.
>The easiest way is to initialise the "pigword" variable to the word itself,
>then if the vowel test never succeeds, the function will return the word
> """Return word converted to piglatin."""
> pig = word # initialise to the word itself.
> blah blah blah # your code goes here
> return pig
I will try to add that next.
More information about the Python-list