Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
215,984 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