What’s wrong with my code?
I get this error:

Does your anti_vowel function take exactly one argument (a string)? Your code threw a “‘str’ object does not support item assignment” error.

def anti_vowel(text):
  text = str(text)
  for index, char in enumerate(text):
    for sec_char in 'AEUIOaeuio':
      if sec_char == char:
        text[index] = ''
  return text



for sec_char in 'AEUIOaeuio'

where is sec_char defined?

strings (text) are immutable in python, they can’t be manipulated. If you want to do this:

text[index] = ''

you will need to convert list to a mutable object like a list


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