Python Python Collections (2016, retired 2019) Lists Disemvowel

Mark Nembhard
Mark Nembhard
1,386 Points

End of file error comes up on my code when i run the dismevowel task

EOFError:EOF and i am not sure why?

disemvowel.py
def disemvowel(word):
    word = input(" what is the word you wish to enter?")    
    name = word.lower()
    a = 0
    for w in name:
        if w == "a":
            del word[a]
        elif lower(w) == "e":
            del word[a]
        elif lower(w) == "i":
            del word[a]
        elif lower(w) == "o":
            del word[a]
        elif lower(w) == "u":
            del word[a]
    a += a   
    return word

1 Answer

Steven Parker
Steven Parker
203,717 Points

The unexpected "input" causes the EOF. Since the word to be processed will be passed in to the function as the argument, you won't need to "input" anything.

Some other things you might need to consider:

  • strings have a "lower" method, but there's no stand-alone "lower" function
  • strings are immutable, so you can't delete just part of a string
  • adding a number to itself creates a geometric progression instead of a linear one
  • be careful not to change the case of the letters in the string that will not be removed
Mark Nembhard
Mark Nembhard
1,386 Points

Thanks. I clearly have a lot to learn still