Anti vovel


could you help?

TypeError: 'builtin_function_or_method' object has no attribute 'getitem'

def anti_vowel(text):
    vovel = ["a","e","i","o","u","A","E","I","O","U"]
    for t in text:
        t = [text]
        b = t.remove[vovel]
        return b
print anti_vowel("ab")


t is a list, t.remove is a method
You're using the [] operator on that method, just like the error message says ([] corresponds to __getitem__)
[] is used for looking things up by index or key, this action does not make sense to do on a method, which is why it has no __getitem__ attribute

Typically what you would do with a method is to call it.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.