8. anti_vowel: Getting the following error...why?


#1

ERROR MESSAGE:

Oops, try again. Does your anti_vowel function take exactly one argument (a string)? Your code threw a "unsupported operand type(s) for -=: 'str' and 'str'" error.

  File "python", line 5
    string += char
         ^
IndentationError: expected an indented block

CODE

def anti_vowel(text):
    string = ""
    for char in text:
        if char not in "aeiouAEIOU":
        string += char 
    return string
    
print anti_vowel(Fabrice)

#2

Hi this line

string += char

should be indent inside the if statement then here

print anti_vowel(Fabrice)

fabrice should be a string


#3

Thank you! Easy troubleshooting I should have caught that -_-


#4

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