Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Lists Disemvowel

Mark Nembhard
Mark Nembhard
1,387 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
231,275 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,387 Points

Thanks. I clearly have a lot to learn still