def anti_vowel(text):

for i in y:
    if i=='a' or i=='e' or i=='i' or i=='o' or i=='u':
        print y.index(i)
        print i
        **z=y.replace(i,"")**(it's showing error as cannot be used in tuple)
        print z
return y

print anti_vowel(x)

Can anyone please help me in writing a remove statement using the same code as above ?


I have skipped caps "AEIOU"


why would you use a tuple()?


I tried to separate the characters in the text and then remove it...


but tuples are immutable, and .replace() is a method for string

we can loop over a string the same way we can loop over a tuple:

a = ('a','b','c')
for i in a:
     print i
b = 'abc'
for i in b:
    print i


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