Your function fails on anti_vowel("Hey look Words!"). It returns "Hy lk Words!" when it should return "Hy lk Wrds!".

I expect my function to delete all of the vowel. I do not undestand why my function the last 'o'

def anti_vowel(text):
    voyl = ['a', 'e', 'i','u','o','A', 'E', 'I', 'O', 'U']
    nvliste = list(text)
    for i in voyl:
        for j in nvliste:
            if i == j:
    str1 = ''.join(nvliste)           
    return str1


index shifts causes a second successive vowel to be skipped

so look causes problems

remove will remove the first o it can find so when the o in word is found, the o of lok (which was skipped) is removed

remove is a difficult approach

use the opposite approach, append consonants to a new list


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